Standards / Extensions | C or C++ | Dependencies |
---|---|---|
Language Environment | both |
#include <uheap.h>
__uheapid_t __ucreate(void *block,
size_t size,
__uheap_cellpool_attrib_table_t *cellpool_attrib_table,
void *rsvd1,
void *rsvd2,
void *rsvd3,
void *rsvd4);
The __ucreate() function creates a heap out of storage that is provided by the caller. The heap is divided up into cell pools based on the information provided in the cellpool_attrib_table. Up to 12 cell pools can be created within the heap. Note that this is a fixed-size heap; when storage within a given cell pool is exhausted, no additional storage will be allocated. __ucreate() returns a uheapid that is used to identify the heap on subsequent user-created heap function calls, such as __umalloc(), __ufree(), and __uheapreport() calls.
The first field of the structure, number_of_pools, indicates the number of cell pools to be created. Up to 12 cell pools can be created in the heap.
The second field of the structure, granularity, indicates the granularity to which storage usage statistics is to be collected. This value must be zero, or a power of 2 greater than or equal to 8. If the value is zero, then statistics are not collected.
Following these words are pairs of words describing the attributes of each cell pool in the heap:
The first field in the pair, size, is the size of the cell in the cell pool. The cell size must be a multiple of 8 and greater than or equal to 8, up to a maximum of 64K (65536). Note that Language Environment adds an additional 8 bytes to the size of the cell for use in managing the cells. The second field in the pair, count, is the number of cells of this size to be allocated. Note the minimum is four.
If successful, __ucreate() returns a uheapid.
If unsuccessful, __ucreate() returns -1 and sets errno to EINVAL.