Allowing Optional RAM Allocation

This section describes how an application can request from OOM Monitor for optional RAM allocation.

An application can allocate RAM optionally by calling the ROomMonitorSession::RequestFreeMemory() method. For more information on optional RAM, refer to Optional RAM Allocation .

An application can release the optional RAM allocation as soon as it is not needed anymore. An application can also keep the optional RAM allocation until OOM Monitor requests to release it.

  1. Create an OOM Monitor session.
            ROomMonitorSession ioomMonitorSession;
    CleanUpClosePushL(ioomMonitorSession);
    User::LeaveIfError(ioomMonitorSession.Connect());
           
  2. Request for optional RAM.
            iOomMonitorSession.RequestOptionalRam(aBytesRequested,aMinimumBytesNeeded,aPluginId,aBytesAvailable);
           

  3. Close the session.
            iOomMonitorSession.Close();