*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> FREE (9r)              
Title
Content
Arch
Section
 

FREE(9r)

Contents


NAME    [Toc]    [Back]

       FREE  -  General: Deallocates (frees) the allocated kernel
       virtual memory

SYNOPSIS    [Toc]    [Back]

       #include <sys/malloc.h>

       FREE(
               void *addr,
               int type );

ARGUMENTS    [Toc]    [Back]

       Specifies the memory pointer that points to the  allocated
       memory  to  be  freed.  You  must have previously set this
       pointer in the call to MALLOC. You also  define  the  data
       type  for  this argument in the call to MALLOC.  Specifies
       the purpose for which the memory is being allocated.   The
       memory  types  are  defined  in the file <malloc.h>. Typically,
 kernel modules use the constant M_DEVBUF  to  indicate
  that  kernel  module  memory  is being allocated (or
       freed).

DESCRIPTION    [Toc]    [Back]

       The FREE routine deallocates (frees) the allocated  kernel
       virtual  memory, which you allocated in a previous call to
       MALLOC.

NOTES    [Toc]    [Back]

       A memory corruption can occur if a kernel module continues
       to  use  the memory after freeing it. The operating system
       provides a built-in mechanism to debug such erroneous  use
       of  memory.  You can enable this debugging feature at boot
       time  by   providing   the   following   boot   parameter:
       kmem_debug=1.  When you enable this debugging feature, the
       FREE routine stores the following  in  the  last  word  of
       freed  memory: The program counter (pc) of the module that
       last freed the memory The checksum of the memory content

       The MALLOC routine checks the checksum of the memory  content
  before  reallocating  this  corrupted memory. If the
       checksum of the memory content does  not  match  the  corrupted
  memory,  MALLOC  stores  the debug information and
       then causes the kernel to panic. The MALLOC routine stores
       the address and size of the corrupted memory and the pc of
       the routine that last  freed  it  in  a  kmem_corrupt_data
       structure.

       You  should  consider the following when using this debugging
 feature: This debugging feature does not detect cases
       where  the  corruption occurs after malloc reallocates the
       freed memory to some  other  module.   There  is  a  small
       chance  that  the  pc of the routine that freed the memory
       (stored in the last  word  of  freed  memory)  may  itself
       become corrupted.








RETURN VALUES    [Toc]    [Back]

       None

SEE ALSO    [Toc]    [Back]

      
      
       Routines: MALLOC(9r)



                                                         FREE(9r)
[ Back ]
 Similar pages
Name OS Title
contig_free Tru64 General: Frees a block of memory previously allocated by contig_malloc
rmfree Tru64 General: Frees space previously allocated into the specified resource map
MALLOC Tru64 General: Allocates a variable-size section of kernel virtual memory
timer_delete Tru64 Deallocates a previously allocated per-process timer (P1003.1b)
kvm_read NetBSD read or write kernel virtual memory
kvm_openfiles NetBSD initialize kernel virtual memory access
kvm_write NetBSD read or write kernel virtual memory
kvm_close FreeBSD initialize kernel virtual memory access
kvm_open OpenBSD initialize kernel virtual memory access
kvm_openfiles OpenBSD initialize kernel virtual memory access
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service