No you don't.  Locked chunks can be freed just fine.  Even in 
"Program 1", there's no need to unlock the handle.

As for the original question, there's no practical difference between 
the two approaches.  It mostly depends on what kind of reference 
(pointer or handle) you have handy.  Usually, you have just the 
pointer, so freeing the chunk with MemPtrFree is common.

-- Keith

At 6:22 PM -0800 1/26/02, John Leung wrote:
>For you second method, you'll still need to unlock the pointer with
>
>MemPtrUnlock(testPtr);
>
>
>On 27 Jan 2002 at 10:21, Andy Yeong wrote:
>
>>  Hi,
>>
>>  As a matter for better understanding, I'm wondering is there
>>  any difference between the 2 program.
>>
>>  char *testPtr;
>>  MemHandle testH;
>>
>>  testH = MemHandleNew(10);       // just create a memory of 10 bytes
>>  testPtr = MemHandleLock(testH);
>>
>>
>>  Program 1's freeing method
>>  ----------------------------
>>
>>  MemHandleUnlock(testH);
>>  MemHandleFree(testH);
>>
>>
>>  Program 2's freeing method
>>  ----------------------------
>>
>>  MemPtrFree(testPtr);
>>
>>
>>  I have tested both methods and it works real fine.
>>  Which is better ? Or simply there isn't any difference ?
>>
>>  Thanks
>>
>>  Best Regards
>  > Andy
>  >

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