diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-C4C8395E-F982-4D6A-88D3-28EDC494817F.dita --- a/Symbian3/SDK/Source/GUID-C4C8395E-F982-4D6A-88D3-28EDC494817F.dita Wed Mar 31 11:11:55 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-C4C8395E-F982-4D6A-88D3-28EDC494817F.dita Fri Jun 11 12:39:03 2010 +0100 @@ -1,85 +1,85 @@ - - - - - -Requesting -RAM AsynchronouslyThis section describes how an application can request for free -RAM asynchronously. -

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

-

Requesting -free RAM asynchronously is recommended as the application is not blocked during -the method call handling.

- -Start an asynchronous -request for a block of memory. -CMemoryAllocatingObject::StartFunctionalityRequiringAllocationL() - { - User::LeaveIfError(iOomMonitorSession.Connect()); - iMemoryRequester = CMemoryRequester::NewL(iOomMonitorSession, *this); - iMemoryRequester->Start(KLargeValueToAllocate); - } - - -Implement the active -object and request for free memory. -void CMemoryRequester::Start(TInt aBytesRequested) - { - iOomMonitorSession.RequestFreeMemory(aBytesRequested, iStatus); - SetActive(); - } - - - -

The following code snippet illustrates an asynchronous request -for free RAM allocation:

const TInt KLargeValueToAllocate = 2097152; //2MB - -// Start an asynchronous request for block of memory -CMemoryAllocatingObject::StartFunctionalityRequiringAllocationL() - { - User::LeaveIfError(iOomMonitorSession.Connect()); - iMemoryRequester = CMemoryRequester::NewL(iOomMonitorSession, *this); - iMemoryRequester->Start(KLargeValueToAllocate); - } - -// Called when the asynchronous request is completed -CMemoryAllocatingObject::MemoryRequestCompleteL(TInt aResult) - { - if (aResult == KErrNone) - { - DoFunctionRequiring_KLargeValueToAllocate_BytesL(); - } - iOomMonitorSession.Close(); - } -The active object implementation is the following: - -// Start an asynchronous request for block of memory -void CMemoryRequester::Start(TInt aBytesRequested) - { - iOomMonitorSession.RequestFreeMemory(aBytesRequested, iStatus); - SetActive(); - } - - -// Called when the asynchronous request is completed -void CMemoryRequester::RunL() - { - iObserver.MemoryRequestCompleteL(iStatus.Int()); - } -
-
-OOM Monitor -Priority -OOM Monitor -Overview -OOM Monitor -Reference + + + + + +Requesting +RAM AsynchronouslyThis section describes how an application can request for free +RAM asynchronously. +

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

+

Requesting +free RAM asynchronously is recommended as the application is not blocked during +the method call handling.

+ +Start an asynchronous +request for a block of memory. +CMemoryAllocatingObject::StartFunctionalityRequiringAllocationL() + { + User::LeaveIfError(iOomMonitorSession.Connect()); + iMemoryRequester = CMemoryRequester::NewL(iOomMonitorSession, *this); + iMemoryRequester->Start(KLargeValueToAllocate); + } + + +Implement the active +object and request for free memory. +void CMemoryRequester::Start(TInt aBytesRequested) + { + iOomMonitorSession.RequestFreeMemory(aBytesRequested, iStatus); + SetActive(); + } + + + +

The following code snippet illustrates an asynchronous request +for free RAM allocation:

const TInt KLargeValueToAllocate = 2097152; //2MB + +// Start an asynchronous request for block of memory +CMemoryAllocatingObject::StartFunctionalityRequiringAllocationL() + { + User::LeaveIfError(iOomMonitorSession.Connect()); + iMemoryRequester = CMemoryRequester::NewL(iOomMonitorSession, *this); + iMemoryRequester->Start(KLargeValueToAllocate); + } + +// Called when the asynchronous request is completed +CMemoryAllocatingObject::MemoryRequestCompleteL(TInt aResult) + { + if (aResult == KErrNone) + { + DoFunctionRequiring_KLargeValueToAllocate_BytesL(); + } + iOomMonitorSession.Close(); + } +The active object implementation is the following: + +// Start an asynchronous request for block of memory +void CMemoryRequester::Start(TInt aBytesRequested) + { + iOomMonitorSession.RequestFreeMemory(aBytesRequested, iStatus); + SetActive(); + } + + +// Called when the asynchronous request is completed +void CMemoryRequester::RunL() + { + iObserver.MemoryRequestCompleteL(iStatus.Int()); + } +
+
+OOM Monitor +Priority +OOM Monitor +Overview +OOM Monitor +Reference
\ No newline at end of file