Frees allocated memory.
Item | Description |
---|---|
ptr | Specifies the address of the area in memory to free. |
heap | Specifies the address of the heap from which the memory was allocated. |
The xmfree kernel service frees the area of memory pointed to by the ptr parameter in the heap specified by the heap parameter. This area of memory must be allocated with the xmalloc kernel service. In addition, the ptr pointer must be the pointer returned from the corresponding xmalloc call.
For example, the xmfree (ptr, kernel_heap) kernel service frees the area in the kernel heap allocated by ptr=xmalloc (size, align, kernel_heap).
A kernel extension must explicitly free any memory it allocates. If it does not, eventually subsequent allocations are unsuccessful. Pinned memory must also be unpinned before it is freed if allocated from the kernel_heap. The kernel does not keep track of which kernel extension owns various allocated areas in the heap. Therefore, the kernel never automatically frees these allocated areas on process termination or device close.
An additional interface to the xmfree kernel service is provided. The free (ptr) is equivalent to xmfree (ptr, kernel_heap).
The xmfree kernel service can be called from the process environment only.
Item | Description |
---|---|
0 | Indicates successful completion. |
-1 | Indicates one of the following errors:
|