HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
m
malloc(3C) malloc(3C)
M_MXFAST Set maxfast to value. The algorithm allocates all blocks below the
size of maxfast in large groups, then doles them out very quickly.
The default value for maxfast is zero.
M_NLBLKS Set numlblks to value. The above mentioned ‘‘large groups’’ each
contain numlblks blocks. numlblks must be greater than 1. The
default value for numlblks is 100.
M_GRAIN Set grain to value. The sizes of all blocks smaller than maxfast are
considered to be rounded up to the nearest multiple of grain. grain
must be greater than zero. The default value of grain is the smal-
lest number of bytes that can accommodate alignment of any data
type. value is rounded up to a multiple of the default when grain is
set.
M_KEEP Preserve data in a freed block until the next malloc(), real-
loc()
,orcalloc(). This option is provided only for compatibil-
ity with the old version of malloc() and is not recommended.
M_BLOCK Block all blockable signals in malloc(), realloc()
, cal-
loc()
, and free(). This option is provided for those who need
to write signal handlers that allocate memory. When set, the
malloc(3C) routines can be called from within signal handlers (they
become re-entrant). Default action is not to block all blockable sig-
nals.
M_UBLOCK Do not block all blockable signals in malloc(), realloc(),
calloc(), and free(). This option cancels signal blocking ini-
tiated by the M_BLOCK option.
These values are defined in the <malloc.h> header file.
mallopt() can be called repeatedly; but once the first small block is allocated, it
is not possible to change the M_MAXFAST, M_NLBLKS, and M_GRAIN values.
mallinfo() Provides instrumentation describing space usage, but cannot be called until the first
small block is allocated. It returns the structure mallinfo:
arena : total space in arena
fsmblks : number of bytes in free small blocks
fordblks : number of bytes in free ordinary blocks
hblks : number of holding blocks
hblkhd : number of bytes in holding block headers
keepcost : cost of enabling keep option
ordblks : number of ordinary blocks
smblks : number of small blocks
uordblks : number of bytes in ordinary blocks in use
usmblks : number of bytes in small blocks in use
The mallinfo structure is defined in the <malloc.h> header file.
Each of the allocation routines returns a pointer to space suitably aligned (after possible pointer coercion)
for storage of any type of object.
memorymap() Displays the contents of the memory allocator for HP-UX 32-bit operating systems
only. A list of addresses and block descriptions is written (using printf())to
standard output. If the value of the show_stats parameter is 1, statistics concerning
number of blocks and sizes used will also be written. If the value is zero, only the
memory map will be written.
The addresses and sizes displayed by memorymap() may not correspond to those
requested by an application. The size of a block (as viewed by the allocator) includes
header information and padding to properly align the block. The address is also
offset by a certain amount to accommodate the header information.
memorymap() has been deprecated at HP-UX 11.11 and will be obsolete at the
next release.
alloca() Allocates space from the stack of the caller for a block of at least size bytes, but does
not initialize the space. The space is automatically freed when the calling routine
Section 3−−508 − 2 − HP-UX Release 11i: December 2000
___
___