On Wed, 12 Apr 2000 11:44:28, Jeff Ishaq  writes:
>Hey folks.  We're battling with dynamic heap fragmentation, and I'd
>appreciate any advice.
>
>Does anyone have any tips or tricks to reduce dynamic heap fragmentation?  I
>was thinking of pulling all of my string allocations out of a common pool of
>memory, instead of little 5 and 10-byte MemPtrNew()'s everywhere.  But I'm
>not sure if that would be any better than simply calling MemHeapCompact()
>from time to time.  I'm not sure how thorough MemHeapCompact() is.

MemHeapCompact() won't help if you've got lots of little locked pointers
in the middle of memory.  Use a heap dump to see what's ending up in the
middle of space, and either don't allocate or don't lock them down.  One
trick is to pre-allocate room for these things early so that they don't
end up in the middle of memory.  Another idea is to just (temporarily, if
necessarily) put them in the storage heap (although the bug where PalmOS
3.5 won't currently clean them up on reset is a problem...)

If you have any idea how many of these 5-byte things you need, then you
can save a bunch of memory using a common pool, or even global variable
space.  The overhead on 5-byte MemPtrNew's is greater than 100%.


Regards,

Ron Nicholson
HotPaw
http://www.hotpaw.com/rhn/hotpaw/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to