author | Dominic Pinkman <dominic.pinkman@nokia.com> |
Fri, 13 Aug 2010 16:47:46 +0100 | |
changeset 14 | 578be2adaf3e |
parent 5 | f345bda72bc4 |
permissions | -rw-r--r-- |
14
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
1 |
<?xml version="1.0" encoding="utf-8"?> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
2 |
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
3 |
<!-- This component and the accompanying materials are made available under the terms of the License |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
4 |
"Eclipse Public License v1.0" which accompanies this distribution, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
5 |
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
6 |
<!-- Initial Contributors: |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
7 |
Nokia Corporation - initial contribution. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
8 |
Contributors: |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
9 |
--> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
10 |
<!DOCTYPE concept |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
11 |
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
12 |
<concept id="GUID-E3DD768F-752F-5414-9E9A-86E046806903" xml:lang="en"><title>Space |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
13 |
management and granularity</title><shortdesc>Explains how to manage space and granularity in dynamic buffers.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
14 |
<p>As the buffer expands, extra space must be allocated. As it contracts, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
15 |
space may be released. In order to tune the management of space, a <i>granularity</i> is |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
16 |
specified to the buffer’s constructor. Space is always allocated and freed |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
17 |
in multiples of this granularity.</p> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
18 |
<p>The granularity should be carefully chosen. Too small a value will result |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
19 |
in too many re-allocations with a cost in time and, due to fragmentation and |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
20 |
segmentation overheads, some waste of space also. Too large a value will result |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
21 |
in over-allocation of space: the extent of the waste of space depends on the |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
22 |
type of data in the buffer: decisions must be made on a case-by-case basis.</p> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
23 |
<p>For flat buffers, the buffer’s single alloc cell is guaranteed to be a |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
24 |
multiple of the granularity in length. When the buffer must be extended, just |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
25 |
sufficient space is allocated to cover the immediate space need (rounded up, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
26 |
if necessary, to the nearest multiple of the granularity). When data is deleted, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
27 |
no automatic space reclamation is performed. The <codeph>Compress()</codeph> function |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
28 |
may be used to compress the allocation to the smallest possible multiple of |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
29 |
the granularity necessary for the data currently held in the buffer.</p> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
30 |
<p>For segmented buffers, the granularity is the number of data bytes in each |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
31 |
segment. Segments additionally have a 16-byte overhead. Therefore, the granularity |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
32 |
of segmented buffers should always be considerably greater than 16, to avoid |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
33 |
significant space waste. When a segmented buffer is extended, enough extra |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
34 |
segments are allocated to contain all the data. When data is deleted from |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
35 |
a segmented buffer, segments are deleted if they contain no data. Segments |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
36 |
whose content is partially deleted may be amalgamated with neighbouring segments, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
37 |
but usually they are left partially full. If the pattern of insertions and |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
38 |
deletions into a segmented buffer is arbitrary, nothing can be said about |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
39 |
the extent of <i>data</i> in each segment: it may range from a single byte |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
40 |
up to the entire segment length — which is the granularity of the buffer. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
41 |
The <codeph>Compress()</codeph> function may be used with segmented buffers |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
42 |
to cause a more efficient allocation of space to its segments.</p> |
1
25a17d01db0c
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
43 |
</conbody></concept> |