At 01:55 PM 7/25/2003, Laurens wrote:
Also, non-movable chunks aren't as bad in Palm OS 3 and higher as they were before, and on current OS 5 devices, the heap space is large enough to allow a bit more flexibility. Also, allocating a handle and then leaving it locked for its entire life is considered worse than just allocating a pointer directly, as the OS expects that handles will generally be unlocked and movable.

Is there any info on how and where the memory manager allocates chunks? What algorithms are used for optimizing memory usage?

The Palm OS Companion has the best details. On Palm OS 3 and later, there is one large storage heap and a smaller dynamic heap. The storage heap is strictly handle-based storage, so it's not that interesting. The dynamic heap allows both handles and always locked chunks (MemPtrNew). In general, allocations for each type are biased towards one end of the heap or the other, so MemPtrNew allocations are clustered near each other while MemHandleNew allocations are arranged at the other end of the heap. This is why a locked handle can be dangerous, as it prevents efficient rearrangement of that end of the heap. The MemPtrNew'd chunks can cause fragmentation for each other, but it takes a fair number of them to reach into the active handle allocation region.


--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to