Classes are OK, but if your class stores a large amount of data, it is better to have the class hold handles, and have the class internally allocate a handle to the data on creation. Then, you'll only be MemPtrNew'ing a small amount of memory, and the larger chunk of memory will be in an unlocked handle for which the class will control access.
This is a good suggestion! Allocating and freeing MemHandles can be dealt with in the constructor and destructor respectively. This will work nicely.
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?
Thanks -Laurens
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
