Article # 46, added by Geoworks, historical record
| first | previous | index | next | last |

Optimizing your Application's State Files





When an application saves to state, it is basically saving the
instance data of any objects in your application that have been
modified.  This can be quite a lot if you have a UI intensive
application.  The problem with saving much of this instance data
to state is that it will not be needed when restoring from state.
Furthermore, it will take up disk space on a device with limited
space.

REDUCING STATE FILE
===================
There are several ways to can eliminate or reduce the size of a
state file:

To prevent the application from creating a state file, subclass
MSG_GEN_PROCESS_CREATE_NEW_STATE_FILE and return NullHandle.
If you need to maintain a minimal amount of state information,
you can store that information in the INI file.

To reduce the size of a state file, you can prevent entire
resources from being saved to state or single objects within a
resource from being saved to state.  

* for resources, the notDetachable flag will prevent the resource
  from being saved to the state file.
	@start SomeResource, notDetachable;

* for single objects, the ignoreDirty flag will prevent that 
  object from being save do to state.
	@object SomeClass SomeObject = ignoreDirty {


SAVING SPECIALIZED DATA
=======================
Geos allows you to save an extra block of data in the state file.
You do this in MSG_GEN_PROCESS_CLOSE_APPLICATION by simply
returning the extra block from the message. This extra block's
handle will be given to you in MSG_GEN_PROCESS_OPEN_APPLICATION
when the application is restarted.


DEBUGGING STATE SAVING
======================
To help you in optimizing the information you allow to be saved to
state, use "showcalls -V". It will show you the loading and unloading
of resources during save-to-state and restore-from-state.