Debian Codegraph @

docs/api_reference/C/dbset_cachesize.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DB-&gt;set_cachesize()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C API Reference" />
10 <link rel="up" href="db.html" title="Chapter 2.  The DB Handle" />
11 <link rel="prev" href="dbset_bt_prefix.html" title="DB-&gt;set_bt_prefix()" />
12 <link rel="next" href="dbset_create_dir.html" title="DB-&gt;set_create_dir()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DB-&gt;set_cachesize()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="dbset_bt_prefix.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 2. 
26 The DB Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="dbset_create_dir.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="dbset_cachesize"></a>DB-&gt;set_cachesize()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB-&gt;set_cachesize(DB *db,
45 u_int32_t gbytes, u_int32_t bytes, int ncache); </pre>
46 <p>
47 Set the size of the shared memory buffer pool -- that is, the cache.
48 The cache should be the size of the normal working data set of the
49 application, with some small amount of additional memory for unusual
50 situations. (Note: the working set is not the same as the number of
51 pages accessed simultaneously, and is usually much larger.)
52 </p>
53 <p>
54 The default cache size is 256KB, and may not be specified as less than
55 20KB. Any cache size less than 500MB is automatically increased by
56 25% to account for buffer pool overhead; cache sizes larger than 500MB
57 are used as specified. The maximum size of a single cache is 4GB on
58 32-bit systems and 10TB on 64-bit systems. (All sizes are in
59 powers-of-two, that is, 256KB is 2^18 not 256,000.) For information on
60 tuning the Berkeley DB cache size, see
61 <a href="../../programmer_reference/general_am_conf.html#am_conf_cachesize" class="olink">Selecting a cache size</a>.
62 </p>
63 <p>
64 It is possible to specify caches to Berkeley DB large enough they
65 cannot be allocated contiguously on some architectures. For example,
66 some releases of Solaris limit the amount of memory that may be
67 allocated contiguously by a process. If <span class="bold"><strong>ncache</strong></span> is 0 or 1, the cache will be allocated
68 contiguously in memory. If it is greater than 1, the cache will be
69 split across <span class="bold"><strong>ncache</strong></span> separate regions,
70 where the <span class="bold"><strong>region size</strong></span> is equal to the
71 initial cache size divided by <span class="bold"><strong>ncache</strong></span>.
72 </p>
73 <p>
74 Because databases opened within Berkeley DB environments use the cache
75 specified to the environment, it is an error to attempt to set a cache
76 in a database created within an environment.
77 </p>
78 <p>
79 The <code class="methodname">DB-&gt;set_cachesize()</code> method may not be called after the
80 <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a> method is called.
81 </p>
82 <p>
83 The <code class="methodname">DB-&gt;set_cachesize()</code> <span>
84 <span>
85 method returns a non-zero error value on failure and 0 on success.
86 </span>
87
88 </span>
89 </p>
90 <div class="sect2" lang="en" xml:lang="en">
91 <div class="titlepage">
92 <div>
93 <div>
94 <h3 class="title"><a id="idp50160872"></a>Parameters</h3>
95 </div>
96 </div>
97 </div>
98 <div class="sect3" lang="en" xml:lang="en">
99 <div class="titlepage">
100 <div>
101 <div>
102 <h4 class="title"><a id="idp50120200"></a>gbytes</h4>
103 </div>
104 </div>
105 </div>
106 <p>
107 The size of the cache is set to <span class="bold"><strong>gbytes</strong></span> gigabytes plus <span class="bold"><strong>bytes</strong></span>.
108 </p>
109 </div>
110 <div class="sect3" lang="en" xml:lang="en">
111 <div class="titlepage">
112 <div>
113 <div>
114 <h4 class="title"><a id="idp50174312"></a>bytes</h4>
115 </div>
116 </div>
117 </div>
118 <p>
119 The size of the cache is set to <span class="bold"><strong>gbytes</strong></span> gigabytes plus <span class="bold"><strong>bytes</strong></span>.
120 </p>
121 </div>
122 <div class="sect3" lang="en" xml:lang="en">
123 <div class="titlepage">
124 <div>
125 <div>
126 <h4 class="title"><a id="idp50172912"></a>ncache</h4>
127 </div>
128 </div>
129 </div>
130 <p>
131 The <span class="bold"><strong>ncache</strong></span> parameter is
132 the number of caches to create.
133 </p>
134 </div>
135 </div>
136 <div class="sect2" lang="en" xml:lang="en">
137 <div class="titlepage">
138 <div>
139 <div>
140 <h3 class="title"><a id="idp50180800"></a>Errors</h3>
141 </div>
142 </div>
143 </div>
144 <p>
145 The <code class="methodname">DB-&gt;set_cachesize()</code> <span>
146 <span>
147 method may fail and return one of the following non-zero errors:
148 </span>
149
150 </span>
151 </p>
152 <div class="sect3" lang="en" xml:lang="en">
153 <div class="titlepage">
154 <div>
155 <div>
156 <h4 class="title"><a id="idp50185648"></a>EINVAL</h4>
157 </div>
158 </div>
159 </div>
160 <p>
161 If the specified cache size was impossibly small; the method was
162 called after <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a>
163 was called; or if an invalid flag value or parameter was specified.
164 </p>
165 </div>
166 </div>
167 <div class="sect2" lang="en" xml:lang="en">
168 <div class="titlepage">
169 <div>
170 <div>
171 <h3 class="title"><a id="idp50186984"></a>Class</h3>
172 </div>
173 </div>
174 </div>
175 <p>
176 <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a>
177 </p>
178 </div>
179 <div class="sect2" lang="en" xml:lang="en">
180 <div class="titlepage">
181 <div>
182 <div>
183 <h3 class="title"><a id="idp50181480"></a>See Also</h3>
184 </div>
185 </div>
186 </div>
187 <p>
188 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a>
189 </p>
190 </div>
191 </div>
192 <div class="navfooter">
193 <hr />
194 <table width="100%" summary="Navigation footer">
195 <tr>
196 <td width="40%" align="left"><a accesskey="p" href="dbset_bt_prefix.html">Prev</a> </td>
197 <td width="20%" align="center">
198 <a accesskey="u" href="db.html">Up</a>
199 </td>
200 <td width="40%" align="right"> <a accesskey="n" href="dbset_create_dir.html">Next</a></td>
201 </tr>
202 <tr>
203 <td width="40%" align="left" valign="top">DB-&gt;set_bt_prefix() </td>
204 <td width="20%" align="center">
205 <a accesskey="h" href="index.html">Home</a>
206 </td>
207 <td width="40%" align="right" valign="top"> DB-&gt;set_create_dir()</td>
208 </tr>
209 </table>
210 </div>
211 </body>
212 </html>