Free the memory when you no longer need it, but no sooner :)

If your callback registration comes and goes, you may want to leave the
memory allocated. If, after unregistering, you do not know when you'll need
it again, free it up. If it's a small amount of memory, you could leave it
for the next reset to 'clean' it up for you, but that's sloppy. Freeing up
when your app is deleted...

--------------------
Jeff Loucks
Work 425-284-1128 [EMAIL PROTECTED]
Home 253-851-8908 [EMAIL PROTECTED]
Mobile 253-691-8812


-----Original Message-----
From: Dr. Vesselin Bontchev [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 14, 2005 8:13 AM
To: Palm Developer Forum
Subject: RE: Global variables and special launch codes


Thanks for the idea!

> 1) MemPtrNew() or MemHandleNew() a structure that contains all the
> info your code needs. Be sure to MemPtrSetOwner() to 0, so the
> memory is not automatically freed when your app exits, unless
> that's okay.

If I do this, when should I free the allocated memory chunk? When my
application is deleted (and/or when I instruct it to stop listening to the
special events from the user interface)?

Regards,
Vesselin

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

Reply via email to