An Out of Memory (OOM) error occurs if an application allocates large amount of RAM in too short time. In such situations, the free RAM level drops as the application allocates RAM faster than the OOM Monitor can release RAM from other applications.
To avoid this OOM Monitor has the KOomMaxAllocationWithoutPermission constant. It defines the maximum amount of RAM that an application can safely allocate within two seconds without OOM Monitor's permission.
The KOomMaxAllocationWithoutPermission value defined in the OOM Monitor header file cannot not be modified. The RAM can be allocated quickly in small pieces as long as the total amount of allocated RAM within two seconds is less than KOomMaxAllocationWithoutPermission.
ROomMonitorSession::RequestFreeMemory() is used for mandatory RAM allocation. For more information, refer to Allowing Large Memory Allocation.
ROomMonitorSession::RequestOptionalRam() is used for optional RAM allocation. For more information, refer to Allowing Optional RAM Allocation.
An application allocates more than KOomMaxAllocationWithoutPermission amount of RAM within two seconds without OOM Monitor's permission. And the OOM Monitor cannot release the RAM fast enough for the application.
An application allocates less than KOomMaxAllocationWithoutPermission amount of RAM within two seconds but
some applications do not release RAM quickly enough when requested (OR)
several applications allocate RAM at the same time.
Therefore it is important that all applications are prepared to handle OOM errors.
To avoid an OOM error, applications must terminate itself without any delay whenever the OOM Monitor requests so. Otherwise the time of free RAM amount below LOW_RAM_THRESHOLD gets longer and another application can allocate RAM during that time resulting in an OOM error.
Applications when closed by the OOM Monitor receives EEikCmdExit event.