"Tilo Christ" <[EMAIL PROTECTED]> wrote in message
news:25168@palm-dev-forum...
> 1) I made a mistake during programming

A fatal alert is certainly appropriate here.

> 2) The device is unsuitable for execution of my software (wrong ROM,
> wrong display)

This is usually tested for in PilotMain. If it's determined that the device
is unsuitable, the launch is aborted. PilotMain returns
sysErrRomIncompatible. But first, the user gets a dialog if the launch code
is sysAppLaunchCmdNormal. (The condition is actually a little more
complicated - see Starter.c for details.)

> 3) I run out of memory

There are two sub-cases here:

3a) Out of dynamic heap space

You can't assume your app is the only active consumer of dynamic heap space
because hacks can use up memory at almost any time. Ideally, you should
handle running out of dynamic heap space gracefully, reporting the error to
the user and letting him continue using the app.

3b) Out of storage heap space

This should be reported to the user in a dialog. The user should be allowed
to continue using the app. This should not cause a fatal alert.

> How do I bring my program to an immediate halt? Much like
> ErrFatalDisplay does it, but without a dialog?

Why do you want to do this?

> What kind of resources do
> I have to clean up manually before halting my program? Do I need to
> close databases, release handles? Or is this done automatically by
> PalmOS if the software is left through a fatal exception?

A fatal exception will force a reset which will clean up just about
everything. Trying to do a lot of clean up yourself before a fatal alert
doesn't make sense, because the cleanup code could fail. The goal of a fatal
alert is to prevent the app from running too far afoul. You want it to stop
before it damages the user's data.

> Also, what can affect the amount of free RAM during runtime? Is it safe
> to assume that if the device has a sufficient amount of free memory at
> the startup time of my software that this fact will not change?

No. Both dynamic and storage heap space can be consumed by hacks.
--
Danny Epstein
OS Engineer, Palm Inc.


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