Hi,

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.

Since there are 2 ways (maybe more) of freeing a memory, there are also 2
ways
of creating memory space. We shall use a memory space of 10 bytes as an
illustration.

For example,

Sample "A"    : testPtr = MemHandleLock(MemHandleNew(10));
Sample "B"    : testPtr = MemPtrNew(10);

Both of the sample written above did create a memory space of 10 bytes.
However,
there is some distinct differences between them.

For sample "A", we could use the API "MemPtrRecoverHandle" to recover the
handle
of that memory block and perform a resizing (bigger or smaller) via the API
"MemHandleResize".

However, sample "B" is not able to recover any handle from it. Does that
mean that
it does not contain any handle that contain information about that memory
block ?
Nevertheless, Palm did have another API for performing resizing for memory
block created using "MemPtrNew"by using "MemPtrResize". But, it only works
for
down sizing and not upsizing (maybe I'm unlucky).

If I remember correctly, I think I have read something about Memory
Management
written in PowerPoint presentation slides by Palm. From the slides, there
seems to be
some differences between handles and pointer. Although both if them seems to
be
pointing to the memory block, but it is of different agenda.

In conclusion, I felt that "MemPtrNew" seems to contain lesser information
that
"MemHandleNew" and thus "MemPtrFree" maybe missing something. But that
ofcourse, it is my personal observation and maybe wrong. Any comments are
most
welcome to better understand those API.

Best Regards
Andy


Joe <[EMAIL PROTECTED]> wrote in message
news:74797@palm-dev-forum...

> I don't know about possible differences in clock cycles, but to help
> avoid the problem of unlocking something that isn't locked or freeing
> something that isn't in allocated, it would be better to always pair
> MemHandleNew with MemHandleFree, MemHandleLock with MemHandleUnlock,
> and MemPtrNew with MemPtrFree.




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