At 10:52 2003-6-5 -0700, Mark Cameron wrote:
Yeah, I'm wondering if that's a problem... but according to the Palm OS
Companion, MemPtrFree should do the same thing as using MemPtrRecoverHandle
and then using MemHandleFree:

"When you no longer need the chunk, call MemPtrFree, which releases the
chunk even if it's locked."


Am I out to lunch locking the handle when I create a string, and unlocking
it when the string is destroyed? Would it be a lot better to unlock the
handle after using MemHandleNew, then lock it down whenever I need access to
the Ptr?

There is no need to unlock/free a handle, MemPtrNew will do the right thing with a locked handle, as it will both free the memory chunk and deallocate the handle data structure.


If you are going to keep a handle locked through its lifetime, it is better to use MemPtrNew. MemPtrNew allocations are done from a different section of memory than MemHandleNew allocations, so you'll have less memory fragmentation if you use the right function, as you won't have this locked handle stuck in the middle of the area from where the rest of the handles are allocated.

--
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