|
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-C642BA79-0E9B-5C62-9DC7-C64759830CD4" xml:lang="en"><title>Dynamic |
|
13 buffers versus descriptors, arrays and heap cells</title><shortdesc>Explains the difference between various types of buffers.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The essential difference between dynamic buffers and more straightforward |
|
15 means of storing binary data is that C arrays and descriptors provide essentially |
|
16 non-extensible buffers. Any attempt to write beyond the end of a C array results |
|
17 in undefined (and usually disastrous) consequences. Any attempt to write beyond |
|
18 the end of a descriptor results in a panic.</p> |
|
19 <p>Heap cells may be extended, but not without limit; it may be impossible |
|
20 to extend a heap cell further, because the heap is exhausted, or too fragmented |
|
21 to permit the extension. In addition, if heap cell re-allocation results in |
|
22 movement of the cell, re-allocation can be unduly expensive. If re-allocation |
|
23 is undesirable, then a buffer could be extended by allocating a new segment |
|
24 in a new allocation cell. Segmented buffers have this behaviour: flat buffers |
|
25 use re-allocation alone.</p> |
|
26 </conbody></concept> |