Initializes a new heap to be used with kernel memory management services.
#include <sys/types.h> #include <sys/errno.h> #include <sys/xmalloc.h> #include <sys/malloc.h>
heapaddr_t init_heap (area, size, heapp) caddr_t area; int size; heapaddr_t *heapp;
|area||Specifies the virtual memory address used to define the starting memory area for the heap. This address must be page-aligned.|
|size||Specifies the size of the heap in bytes. This value must be an integral number of system pages.|
|heapp||Points to the external heap descriptor. This must have a null value. The base kernel uses this field is used to specify special heap characteristics that are unavailable to kernel extensions.|
The init_heap kernel service is most commonly used by a kernel process to initialize and manage an area of virtual memory as a private heap. Once this service creates a private heap, the returned heapaddr_t value can be used with the xmalloc or xmfree service to allocate or deallocate memory from the private heap. Heaps can be created within other heaps, a kernel process private region, or even on a stack.
Few kernel extensions ever require the init_heap service because the exported global kernel_heap and pinned_heap are normally used for memory allocation within the kernel. However, kernel processes can use the init_heap service to create private nonglobal heaps within their process private region for controlling kernel access to the heap and possibly for performance considerations.
The init_heap kernel service can be called from the process environment only.
The init_heap kernel service is part of Base Operating System (BOS) Runtime.
The xmalloc kernel service, xmfree kernel service.
Memory Kernel Services and Using Kernel Processes in AIX Kernel Extensions and Device Support Programming Concepts.