diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-0185D5DC-5142-42C3-8FFB-8EB76D49AB06.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-0185D5DC-5142-42C3-8FFB-8EB76D49AB06.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,52 @@ + + + + + +Requesting +RAM SynchronouslyThis section describes how an application can request for free +RAM synchronously. +

Perform the steps +described in Allowing +Large Memory Allocation.

+

Requesting +free RAM synchronously is easy to implement because no active object is needed +and is recommended when there is no need to perform any other task while waiting +for the request to complete. This approach is not recommended in case of a +server, as synchronous call blocks the server and it cannot serve its clients +during synchronous wait.

+ +Request free memory. + User::LeaveIfError(iOomMonitorSession.RequestFreeMemory(KLargeValueToAllocate)); +DoFunctionRequiring_KLargeValueToAllocate_Bytes(); + + +

The following code snippet illustrates an synchronous request +for 2MB RAM:

TInt KLargeValueToAllocate = 2097152; //2MB + +// Create an OOM Monitor session +ROomMonitorSession oomMonitorSession; +CleanUpClosePushL(oomMonitorSession); +User::LeaveIfError(oomMonitorSession.Connect()); + +// Request free memory +User::LeaveIfError(iOomMonitorSession.RequestFreeMemory(KLargeValueToAllocate)); +DoFunctionRequiring_KLargeValueToAllocate_Bytes(); + +// Tidy up +CleanupStack::PopAndDestroy(); //oomMonitorSession, calls Close() +
+
+OOM Monitor +Priority +OOM Monitor +Overview +OOM Monitor +Reference +
\ No newline at end of file