> Personally, I felt that "MemPtrFree" is missing something. Although it
did
> release the memory back to the OS, but it seems to be still holding
some
> information of that memory block.

You are too paranoid about this.

All memory in the dynamic heap is stored as chunks.  A chunk has a lock
count.  MemPtrNew gives you a chunk with a lock count of 15, which is a
signal to the OS that this chunk cannot be moved.  MemHandleNew gives
you a chunk with a lock count of 0, and it also allocates a handle in
the handle list.

When you do a MemPtrFree, you actually are calling MemChunkFree.  This
routine looks in the chunk header and knows if there is an attached
handle, so it will always free the correct amount of memory.  When you
call MemHandleFree, it just turns the handle into a chunk pointer, then
calls MemChunkFree.



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

Reply via email to