mallopt [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
mallopt
Provides control over the memory allocation algorithm.
Syntax
#include <malloc.h>
int mallopt (int cmd, int value);
Parameters
cmd The available values for cmd are:
M_MXFAST Set maxfast to value. The algorithm
allocates all blocks below the size of
maxfast in large groups and then passes them
out very quickly. The default value for
maxfast is 24.
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 smallest number of
bytes that allows alignment of any data type.
The value parameter 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, realloc, or calloc. This option is
provided only for compatibility with other
systems and is not recommended.
value An integer value used by cmd.
Return Values
0 Success.
1 Indicates malloc() has been previously called or that
arguments have illegal values.
Description
The mallopt function returns a pointer to space suitably aligned, after
possible pointer coercion, for storage of any type of object. It also
provides control over the main memory allocation algorithm. The mallopt
function may be called repeatedly, but may not be called after the first
small block is allocated.
The contents of a block are not preserved when it is freed, unless the
M_KEEP option of mallopt() is specified in cmd.
NOTE The header <malloc.h> and the mallopt() and mallinfo() functions
are not ANSI C and should be avoided if portability is a
consideration.
See Also
free(), realloc(), calloc(), mallinfo(), mallopt(), malloc()
MPE/iX 5.0 Documentation