MoveHHi
MoveHHi
Move a relocatable block as high as possible Handle theHandle ; handle to data to be uplifted MoveHHi moves data as high as possible in its heap zone. By using this before locking a handle, you can avoid some heap fragmentation.
theHandle is a handle leading to a relocatable memory block. It is typically a
nilHandleErr (-109) theHandle is NIL
memLockedErr (-117) theHandle is currently locked
Notes: MoveHHi moves the handle's data upward toward the top of the heap. It stops looking higher when it en counters any nonrelocatable block, a locked
relocatable block, or the last block in the heap.
Of course, it takes time to move chunks of data around in memory, but a
fragmented heap can bring your application to its knees. It is a good
practice to pay special attention to locked and nonrelocatable blocks. If you
intend to lock a block (see HLock or HLockHi) for any length of time, or during a period in which a nonrelocatable block will be allocated, you are
advised to use MoveHHi before locking the block. The real problem with fragmentation is that the Memory Manager won't
move relocatable blocks around nonrelocatable blocks (e.g., all Handles below a Ptr must stay below it).