Symbian3/SDK/Source/GUID-D664843A-0741-5E38-88D0-D8BEC9C732EB.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-D664843A-0741-5E38-88D0-D8BEC9C732EB.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-D664843A-0741-5E38-88D0-D8BEC9C732EB" xml:lang="en"><title>How
+to destroy the array</title><shortdesc>Simple arrays can be simply deleted. Certain arrays of pointers
+may require calling a member function to delete the objects pointed to.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>If an array consists of <codeph>T</codeph> or <codeph>R</codeph> type elements,
+it can be destroyed by simply deleting it:</p>
+<codeblock id="GUID-DD031059-EB7F-5767-95EB-01D9715214DF" xml:space="preserve">delete array;</codeblock>
+<p>Where the array is either a <codeph>CArrayPtrFlat</codeph> or <codeph>CArrayPtrSeg</codeph> object
+and the elements are pointers to <codeph>CBase</codeph> derived objects, then
+these objects should first be destroyed by calling the <codeph>ResetAndDestroy()</codeph> member
+function:</p>
+<codeblock id="GUID-FAFAE1AE-CCE3-5B5B-95A0-BAC900706C19" xml:space="preserve">array-&gt;ResetAndDestroy();
+delete array;</codeblock>
+<section id="GUID-16F6086C-6072-447A-BFE5-C3C4869033BF"><title>Notes</title> <ul>
+<li id="GUID-84F5B547-631E-5FD5-8C3B-736BEB2A94FB"><p>The <codeph>RArray&lt;class T&gt;</codeph> and <codeph>RPointerArray&lt;class T&gt;</codeph> types
+are normally allocated on the program stack and are not deleted. However,
+their array buffers <i>are</i> allocated on the heap and it is important that
+these arrays are handled correctly to avoid memory leaks.</p> </li>
+<li id="GUID-98A2BC12-BEC2-5C29-93A1-51531D5F5063"><p>As a minimum, their <codeph>Close()</codeph> functions
+must be called before the arrays go out of scope. Additionally, for the <codeph>RPointerArray&lt;class T&gt;</codeph> type,
+the <codeph>ResetAndDestroy()</codeph> function may be called if the objects
+represented by the array need to be deleted before the array goes out of scope.</p> </li>
+</ul> </section>
+</conbody></concept>
\ No newline at end of file