CompactMemSys
CompactMem
Compact heap until a specified block is available Size CompactMem( bytesNeeded ); Size bytesNeeded ; size of allocation block required returns size of largest free block after compaction
CompactMem performs a partial or complete compaction of the heap,
attempting to create a contiguous block of a specified size.
bytesNeeded is the size, in bytes, of a block of memory. The heap is compacted
until a bytesNeeded block is formed.
Returns: the size of the largest contiguous block of memory after the partial or complete compaction is performed.
Notes: There is another routine, CompactMemSys, which performs the equivalent operation to CompactMem, but in the System heap zone. It takes
the same parameters as CompactMem.
CompactMem does not actually allocate any memory. It performs
compaction, without attempting to purge blocks or grow the heap zone. Be
sure to check the return value to see if bytesNeeded or more bytes were
found.
Use PurgeSpace to obtain the size of the block that would be available if both compacting and purging were performed.