|
|
|
Applications need to handle memory efficiently, that is, not use more memory than they need, and release memory when they are done with it.
If memory runs out, for example, while editing, no data already entered should be lost. The existing data should be saved. The user will not expect to be able to enter more data before remedial actions, but will expect the existing, already entered, data to remain.
If an application cannot allocate memory needed, it must not panic and must not loose any existing data.
When memory runs low, the Memory Manager requests an application to close down. The default behavior is as explained in the Application Closing section. However, this behavior can be overridden by implementing an alternative CEikDocument::SaveL() method.
For all non-system applications running in the background, the Memory Manager calls the CEikDocument::SaveL(MSaveObserver::TSaveType aSaveType) method with the aSaveType set to EReleaseRAM.
Normally, the application is expected to use the default behavior, which is to save its data and then exit. But applications that are, for example, downloading data can, by overriding this method, choose to not exit in such cases. Overriding the default behavior should be done with caution.
The application should not override the default behavior of the EReleaseRAM notification without taking caution.
An application must always keep track of the resources it creates. When a resource is no longer needed, it should be freed. All memory allocated should be de-allocated if the application is closed. This is something to keep in mind during the complete lifetime of the application.
An application must not have any memory or resource leaks.