> From: Eric [mailto:[EMAIL PROTECTED]]
> if I call MemHandleNew to create a new array of strings to
> populate a list at runtime, then should I call MemHandleFree
> after calling LstSetListChoices?
Yes you have to free that memory yourself eventually, but not while the list
remains active on the screen. The frmClose event is a good time to free
this memory.
> Or does LstSetListChoices know to free the memory of the old
> data?
No it doesn't. If you leave the list untouched so it displays the text
originally entered in Constructor/PilRC, then no problem. But you remain
the owner of anything you pass to LstSetListChoices.
> This might be a problem because if I keep calling MemHandleNew and
> nowhere free the old memory chunks, then I will use up all the
> memory very quickly!!
Right, that's a Very Bad Thing called a memory leak.
> If I call MemHandleUnlock, will they check to free the chunk
> if no program needs it anymore?
No, if you don't free it, it's a memory leak. (If you are accustomed to
Java garbage collection, there is no such thing here. This is old fashioned
C/C++ memory management.) I highly suggest testing on the 3.5 debug ROM.
It warns you about any memory leaks when your application quits.
-slj-
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html