Ben Combee wrote:
> As part of a program's shutdown code, just before returning to the OS
> for the next app to be launched, it will go through and release all
> dynamic heap chunks with the owner ID of the program.  This doesn't
> affect storage heap memory and doesn't free chunks where you've
> explicitly set the chunk ownership to a different ID.

Ben, can you clarify this a bit?  I'm used to programming on
Unix/Linux and other "big operating systems" where when a program
exits, all memory allocated by malloc(3) will be automatically
freed.

I've been trying to figure out exactly what happens when a Palm OS
application "exits".  I understand that when the power button is
pressed to turn the device "off", it is simply put in sleep mode,
and when powered on again, the program continues to run -- so it
hasn't exited.

But when execution transfers to Launcher, it seems that the application
is signaled to exit with an appStopEvent.  So the usual action is
to execute AppStop to save Application Preferences and Database records,
then free any malloc'd memory and close all forms with a FrmCloseAllForms()
call.

But what exactly happens next?  What does the system do with this
application before switching to the Launcher or other application?

Are you saying that it automatically frees all memory allocated
using MemHandleNew()?

What about other system resources used by the application?

Jay Ts

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

Reply via email to