~ubuntu-branches/ubuntu/precise/sqlite3/precise-updates

« back to all changes in this revision

Viewing changes to www/malloc.html

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-12-11 14:34:09 UTC
  • mfrom: (9.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091211143409-o29fahwmcmyd0vq1
Tags: 3.6.21-2
Run autoreconf to prevent FTBFS with new libtool (closes: #560660).

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<style type="text/css">
5
5
body {
6
6
    margin: auto;
7
 
    font-family: "Verdana" "sans-serif";
 
7
    font-family: Verdana, sans-serif;
8
8
    padding: 8px 1%;
9
9
}
10
10
 
16
16
  float:right;
17
17
  text-align:right;
18
18
  font-style:italic;
19
 
  width:240px;
 
19
  width:300px;
20
20
  margin:12px;
21
21
  margin-top:58px;
22
22
}
43
43
.ne  { background: url(images/ne.png) 100% 0% no-repeat }
44
44
.nw  { background: url(images/nw.png) 0% 0% no-repeat }
45
45
 
 
46
/* Things for "fancyformat" documents start here. */
 
47
.fancy .codeblock i { color: darkblue; }
 
48
.fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#80a796}
 
49
.fancy h2 { margin-left: 10px }
 
50
.fancy h3 { margin-left: 20px }
 
51
.fancy h4 { margin-left: 30px }
 
52
.fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444}
 
53
.fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top}
 
54
.fancy #toc a        { color: darkblue ; text-decoration: none }
 
55
.fancy .todo         { color: #AA3333 ; font-style : italic }
 
56
.fancy .todo:before  { content: 'TODO:' }
 
57
.fancy p.todo        { border: solid #AA3333 1px; padding: 1ex }
 
58
.fancy img { display:block; }
 
59
.fancy :link:hover, .fancy :visited:hover { background: wheat }
 
60
.fancy p,.fancy ul,.fancy ol { margin: 1em 5ex }
 
61
.fancy li p { margin: 1em 0 }
 
62
/* End of "fancyformat" specific rules. */
 
63
 
46
64
</style>
47
65
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
48
66
  
65
83
    <a href="download.html">Download</a>
66
84
    <a href="copyright.html">License</a>
67
85
    <a href="news.html">News</a>
68
 
    <a href="http://www.sqlite.org/cvstrac/index">Developers</a>
 
86
    <!-- <a href="dev.html">Developers</a> -->
69
87
    <a href="support.html">Support</a>
70
88
  </div></div></div></div></div>
71
89
</td></tr></table>
91
109
be useful to engineers who are tuning SQLite to comply with special
92
110
requirements or to run under unusual circumstances.</p>
93
111
 
94
 
<p><i>This report is a work in progress...</i></p>
95
 
 
96
112
<a name="features"></a>
97
113
<h2>1.0 Features</h2>
98
114
 
110
126
Failing that, SQLite will either stop what
111
127
it is doing and return the
112
128
<a href="c3ref/c_abort.html">SQLITE_NOMEM</a> error code back up to the application or it will
113
 
make due without the requested memory.
 
129
make do without the requested memory.
114
130
</p></li>
115
131
 
116
132
<li><p>
183
199
<h2>2.0 Testing</h2>
184
200
 
185
201
<p>Over
186
 
75% of the code in the SQLite source tree is devoted purely to testing
187
 
and verification.  Reliability is important to SQLite.
 
202
75% of the code in the SQLite source tree is devoted purely to 
 
203
<a href="testing.html">testing and verification</a>.  Reliability is important to SQLite.
188
204
Among the tasks of the test infrastructure is to insure that
189
205
SQLite does not misuse dynamically allocated memory, that SQLite
190
206
does not leak memory, and that SQLite responds
260
276
 
261
277
<p>Finally, we observe that the instrumented memory allocator and the
262
278
memory leak detector both work over the entire SQLite test suite and
263
 
the test suite provides over 99% statement test coverage.  This is
 
279
the <a href="testing.html#tcl">TCL test suite</a> provides over 99% statement test coverage and that
 
280
the <a href="th3.html">TH3</a> test harness provides <a href="testing.html#coverage">100% branch test coverage</a>
 
281
with no leak leaks. This is
264
282
strong evidence that dynamic memory allocation is used correctly
265
283
everywhere within SQLite.</p>
266
284
 
274
292
Both compile-time and start-time configuration options are available.</p>
275
293
 
276
294
<a name="altalloc"></a>
 
295
 
277
296
<h3>3.1 Alternative low-level memory allocators</h3>
278
297
 
279
298
<p>The SQLite source code includes several different memory allocation
306
325
then a different, heavy wrapper is used around system malloc(), realloc(), 
307
326
and free().
308
327
The heavy wrapper allocates around 100 bytes of extra space
309
 
with each allocation.  The extra space is used to places sentinel values 
 
328
with each allocation.  The extra space is used to place sentinel values 
310
329
at both ends of the allocation returned to the SQLite core.  When an
311
330
allocation is freed,
312
331
these sentinels are checked to make sure the SQLite core did not overrun
813
832
 
814
833
<p>Colloquially, the Robson proof shows that in order to guarantee
815
834
breakdown-free operation, any memory allocator must use a memory pool
816
 
of size <b>N</b> which exceeds the maximum amount of memory every
 
835
of size <b>N</b> which exceeds the maximum amount of memory ever
817
836
used <b>M</b> by a multiplier that depends on <b>n</b>, 
818
837
the ratio of the largest to the smallest allocation size.  In other
819
838
words, unless all memory allocations are of exactly the same size
1039
1058
<h2>6.0 Summary Of Memory Allocator Interfaces</h2>
1040
1059
 
1041
1060
<p><i>To be completed...</i></p>
1042
 
<hr><small><i>
1043
 
This page last modified 2009/01/12 14:56:48 UTC
1044
 
</i></small></div></body></html>
 
1061