Destroy A User-Defined Heap

When you have finished using a user-defined heap, close it with _uclose. Once you have closed the heap in a process, that process can no longer allocate from or return memory to that heap. If other processes share the heap, they can still use it until you close it in each of them. Performing operations on a heap after you have closed it causes undefined behavior.

To finally destroy the heap, call _udestroy. If blocks of memory are still allocated somewhere, you can force their destruction. Destroying a heap removes it entirely even if it was shared by other processes. Again, performing operations on a heap after you have destroyed it causes undefined behavior.

After you destroy your fixed-size heap, it is up to you to return the memory for the heap (the initial block of memory you supplied to _ucreate and any other blocks added by _uaddmem) to the system.



Memory Management Functions


Use a User-Defined Heap
Shrink a User-Defined Heap