HeapAllocHigh Function (ROM Call 0x92)

alloc.h

HANDLE HeapAllocHigh (unsigned long Size);

Allocates memory at the high end of the heap and returns the handle of the allocated block.

HeapAllocHigh allocates a block of Size bytes of heap memory at the high end of the heap, locks it, and returns its handle. Returns H_NULL if there is not enough memory. The primary use of this routine is to allocate task local storage. It also compresses the heap first to (hopefully) move all used (unlocked) blocks of memory down. This routine will cause garbage collection.

Note: Blocks of memory that are locked for long periods of time should be moved high in memory so that they do not interfere as much with rest of the system. This routine ALWAYS compresses the heap before it tries to allocate the requested memory and so is much slower than the standard HeapAlloc routine. Locking memory may cause the system to run out of useable memory sooner than if memory is kept unlocked.


Uses: HeapAlloc, HeapCompress, HeapGetHandle, HeapLock, NeedStack
Used by: HeapAllocHighThrow, HeapAllocPtr, malloc, GrayOn, HS_popEStack


See also: HeapAlloc