Symbian3/SDK/Source/GUID-0371FD21-D988-4560-891F-2840C36AB2E2.dita
changeset 7 51a74ef9ed63
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     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 concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-0371FD21-D988-4560-891F-2840C36AB2E2" xml:lang="en"><title>Out
       
    13 of Memory Error</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>An Out of Memory (OOM) error occurs if an application allocates large amount
       
    15 of RAM in too short time. In such situations, the free RAM level drops as
       
    16 the application allocates RAM faster than the OOM Monitor can release RAM
       
    17 from other applications.</p>
       
    18 <p>To avoid this OOM Monitor has the <codeph>KOomMaxAllocationWithoutPermission</codeph> constant.
       
    19 It defines the maximum amount of RAM that an application can safely allocate
       
    20 within two seconds without OOM Monitor's permission.</p>
       
    21 <p> The <codeph>KOomMaxAllocationWithoutPermission</codeph> value defined
       
    22 in the OOM Monitor header file cannot not be modified. The RAM can be allocated
       
    23 quickly in small pieces as long as the total amount of allocated RAM within
       
    24 two seconds is less than <codeph>KOomMaxAllocationWithoutPermission</codeph>. </p>
       
    25 <p>If an application needs to allocate more RAM than <codeph>KOomMaxAllocationWithoutPermission</codeph> value,
       
    26 it must request permission from the OOM Monitor. OOM Monitor provides two
       
    27 different methods for this purpose. <ul>
       
    28 <li><p><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> is used
       
    29 for mandatory RAM allocation. For more information, refer to <xref href="GUID-50CA5439-29A1-426C-83BA-EC048FE86CDE.dita">Allowing
       
    30 Large Memory Allocation</xref>.</p></li>
       
    31 <li><p><xref href="GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73.dita#GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73/GUID-D0AD593E-3C07-34B5-B8A2-24AABA42AFD7"><apiname>ROomMonitorSession::RequestOptionalRam()</apiname></xref> is used
       
    32 for optional RAM allocation. For more information, refer to <xref href="GUID-217C992B-AC56-42A7-9920-DEC891D233A5.dita">Allowing
       
    33 Optional RAM Allocation</xref>.</p></li>
       
    34 </ul> OOM error can still occur in the following situations:</p>
       
    35 <ul>
       
    36 <li><p>An application allocates more than <codeph>KOomMaxAllocationWithoutPermission</codeph> amount
       
    37 of RAM within two seconds without OOM Monitor's permission. And the OOM Monitor
       
    38 cannot release the RAM fast enough for the application.</p></li>
       
    39 <li><p>An application allocates less than <codeph>KOomMaxAllocationWithoutPermission</codeph> amount
       
    40 of RAM within two seconds but </p><ul>
       
    41 <li><p>some applications do not release RAM quickly enough when requested
       
    42 (OR)</p></li>
       
    43 <li><p>several applications allocate RAM at the same time.</p></li>
       
    44 </ul></li>
       
    45 </ul>
       
    46 <p>Therefore it is important that all applications are prepared to handle
       
    47 OOM errors. </p>
       
    48 <section id="GUID-77B379F3-1ECA-4C62-A9C9-720C8882ED43"><title>Closing an
       
    49 application on the OOM Monitor request</title><p>To avoid an OOM error, applications
       
    50 must terminate itself without any delay whenever the OOM Monitor requests
       
    51 so. Otherwise the time of free RAM amount below <keyword>LOW_RAM_THRESHOLD</keyword> gets
       
    52 longer and another application can allocate RAM during that time resulting
       
    53 in an OOM error.</p><p>Applications when closed by the OOM Monitor receives <codeph>EEikCmdExit</codeph> event.</p></section>
       
    54 </conbody></concept>