This document is a single-page version of a a multi-page document, suitable for easy printing.

Memory Levels

This chapter collects various utility routines and concepts that may not adequately be addressed within other chapters.

If you are writing an application that requires use of memory, you will want to keep track of how much memory is available on the Nokia 9000i Communicator's flash file system (FFS).


Memory Levels: 1 Memory Levels

Operations that require writing to the FFS should almost always check "disk space" both before and after the operation. There are three defined levels of available disk space on the device. These levels are:

You can check for these conditions by using the following constants:

FFS checking is usually needed at the following times:


Memory Levels: 2 Modifying Files on the FFS

FoamWarnForSaving(), FoamSaveAction

Whenever you perform an operation that modifies a file on the FFS, you should make sure that you have enough space to save the file. For example, you may bring up a document, modify it, and then wish to close the app, saving the document as it now exists.

In those case, use FoamWarnForSaving() to make sure you can proceed with the operation. Pass this routine the number of bytes required for the operation. The routine checks if there is enough memory available for the operation. If there is, it returns FSA_SAVE_DATA. Otherwise, it initiates a dialog box that asks you whether you wish to either throw away the changes or cancel the operation.

FoamWarnForSaving() returns one of the following FoamSaveAction values:

FSA_SAVE_DATA
The operation is well within the limits.
FSA_THROW_AWAY_CHANGES
The operation could not proceed due to memory constraints, and the user chose to discard the changes. Proceed accordingly. (You might, for example, allow the app to close.)
FSA_DO_NOTHING
The operation could not proceed due to memory constraints, and the user chose to cancel the operation. Proceed accordingly. (You should not allow the app to close, for example.)

Memory Levels: 3 Operations that Consume FFS Space

FoamWarnIfNotEnoughSpace(), FoamCheckIfOutOfSpace(), FoamDiskSpaceStatus

Some operations may consume memory once they are begun, and it might be difficult to stop them once they start. For example, receiving a fax, reading or receiving e-mail, downloading something from the Web or printing a document may all consume FFS space.

FoamWarnIfNotEnoughSpace() takes a numeric value corresponding to the bytes required for the operation. If the operation would result in memory falling below the critical level, the routine will notify the user that it has insufficient memory to complete the operation (via a dialog box) and will return FDDS_FULL.

If the operation can proceed otherwise, it will return the appropriate FoamDiskSpaceStatus value:

FDDS_NOT_FULL
FDDS_NEARLY_FULL
FDDS_FULL

FoamCheckIfOutOfSpace() also returns a FoamDiskSpaceStatus but does not initiate any dialog box.

You should call FoamWarnSpaceAfter Operation() after any operation that consumes FFS space. If the operation resulted in an FDDS_NEARLY_FULL status, the routine brings up a dialog alerting the user that the device is nearly out of FFS space.


Memory Levels: 4 Utility Space Routines

FoamGetFreeSpace(), FoamCheckIfOutOfSpace()

FoamGetFreeSpace() returns the number of bytes of free space.

FoamCheckIfOutOfSpace() also returns a FoamDiskSpaceStatus but does not initiate any dialog box.


This document is a single-page version of a a multi-page document, suitable for easy printing.