|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-50CA5439-29A1-426C-83BA-EC048FE86CDE" xml:lang="en"><title>Allowing |
|
13 Large Memory Allocation</title><shortdesc>This section describes how an application can request for free |
|
14 memory from OOM Monitor for large amount of RAM allocation.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <context id="GUID-54D945B5-EFE2-4639-B040-7A6321448A07"> <p>An application |
|
16 can allocate RAM without seeking the permission from the OOM Monitor if the |
|
17 amount of RAM is not over <xref href="GUID-75DB7CA6-08F0-3CFB-ADDF-621FFF5B8058.dita"><apiname>KOomMaxAllocationWithoutPermission</apiname></xref> limit. |
|
18 </p><p>If an application needs to allocate more RAM than allocated by <xref href="GUID-75DB7CA6-08F0-3CFB-ADDF-621FFF5B8058.dita"><apiname>KOomMaxAllocationWithoutPermission</apiname></xref>, |
|
19 it must request the OOM Monitor using the <xref href="GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73.dita#GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73/GUID-BE322080-5193-3D8E-9425-C6BEA920ED2E"><apiname>ROomMonitorSession::RequestFreeMemory()</apiname></xref> method. </p><p>An |
|
20 application can request for free RAM either synchronously or asynchronously.</p> |
|
21 </context> |
|
22 <steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-8-1-10-1-1-8-1-5-1-6-1-6-1-3-2"> |
|
23 <step id="GUID-83631E4F-71D0-4FD2-8FD6-46689AAFA761-GENID-1-8-1-10-1-1-8-1-5-1-6-1-6-1-3-2-1"><cmd>Create an OOM Monitor |
|
24 session</cmd> |
|
25 <info><codeblock xml:space="preserve">ROomMonitorSession ioomMonitorSession; |
|
26 CleanUpClosePushL(ioomMonitorSession); |
|
27 User::LeaveIfError(ioomMonitorSession.Connect()); |
|
28 </codeblock></info> |
|
29 </step> |
|
30 <step id="GUID-83631E4F-71D0-4FD2-8FD6-46689AAFA761-GENID-1-8-1-10-1-1-8-1-5-1-6-1-6-1-3-2-2"><cmd>Request for free |
|
31 memory can be done in two ways:</cmd> |
|
32 </step> |
|
33 </steps> |
|
34 <result id="GUID-1D804A3D-8EEC-4E62-8496-2A43CCDC0BEB"><p>The OOM Monitor |
|
35 allows the client application to allocate memory, if the free RAM level is |
|
36 above the <codeph>LOW_RAM_THRESHOLD</codeph> value.</p><p> If the free RAM |
|
37 level is below the <codeph>LOW_RAM_THRESHOLD</codeph> value, |
|
38 the OOM Monitor releases RAM using <xref href="GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73.dita#GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73/GUID-BE322080-5193-3D8E-9425-C6BEA920ED2E"><apiname>ROomMonitorSession::RequestFreeMemory()</apiname></xref> method. |
|
39 This method returns the following values: <ul> |
|
40 <li><p>Requested amount of RAM is available then <codeph>aStatus</codeph> is |
|
41 set to <codeph>KErrNone</codeph>.</p></li> |
|
42 <li><p>Requested amount of RAM is not available then <codeph>aStatus</codeph> is |
|
43 set to <codeph>KErrNoMemory</codeph>.</p></li> |
|
44 </ul> </p></result> |
|
45 </taskbody><related-links> |
|
46 <link href="GUID-F6A33835-D677-41D0-86BB-812E3AFA5192.dita"><linktext>OOM Monitor |
|
47 Concepts</linktext></link> |
|
48 <link href="GUID-39A8FBC9-5FD6-4F92-B71E-5C5438ECFD46.dita"><linktext>OOM Monitor |
|
49 Overview</linktext></link> |
|
50 <link href="GUID-88752800-83BD-4845-80A0-6B65D8D81924.dita"><linktext>OOM Monitor |
|
51 Reference</linktext></link> |
|
52 </related-links></task> |