Debian Codegraph @

docs/api_reference/C/envset_memory_init.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_ENV-&gt;set_memory_init()</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="env.html" title="Chapter 5.  The DB_ENV Handle" />
11 <link rel="prev" href="envset_isalive.html" title="DB_ENV-&gt;set_isalive()" />
12 <link rel="next" href="envset_memory_max.html" title="DB_ENV-&gt;set_memory_max()" />
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_ENV-&gt;set_memory_init()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_isalive.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. 
26 The DB_ENV Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envset_memory_max.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="envset_memory_init"></a>DB_ENV-&gt;set_memory_init()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;set_memory_init(DB_ENV *dbenv, DB_MEM_CONFIG type,
45 u_int32_t count); </pre>
46 <p>
47 This method sets the number of objects to allocate and initialize
48 for a specified structure when an environment is created. Doing
49 this helps avoid memory contention after startup. Using this
50 method is optional; failure to use this method causes BDB to
51 allocate a minimal number of structures that will grow dynamically.
52 These structures are all allocated from the main environment
53 region. The amount of memory in this region can be set via the
54 <a class="xref" href="envset_memory_max.html" title="DB_ENV-&gt;set_memory_max()">DB_ENV-&gt;set_memory_max()</a>
55 method. If this method is not called then memory will be limited
56 to the initial settings or by the (deprecated) set maximum
57 interfaces.
58 </p>
59 <p>
60 The database environment's initialization may also be configured
61 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax of the entry
62 in that file is a single line with the string "set_memory_init",
63 one or more whitespace characters, followed by the struct
64 specification, more white space and the count to be allocated.
65 Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read when the database environment
66 is opened, it will silently overrule configuration done before
67 that time.
68 </p>
69 <p>
70 The <code class="methodname">DB_ENV-&gt;set_memory_init()</code> method must
71 be called prior to opening the database environment. It may be
72 called as often as needed to set the different configurations.
73 </p>
74 <div class="sect2" lang="en" xml:lang="en">
75 <div class="titlepage">
76 <div>
77 <div>
78 <h3 class="title"><a id="idp52161472"></a>Parameters</h3>
79 </div>
80 </div>
81 </div>
82 <div class="sect3" lang="en" xml:lang="en">
83 <div class="titlepage">
84 <div>
85 <div>
86 <h4 class="title"><a id="idp52157848"></a>type</h4>
87 </div>
88 </div>
89 </div>
90 <p>
91 The <span class="bold"><strong>type</strong></span> parameter must be
92 set to one of the following:
93 </p>
94 <div class="itemizedlist">
95 <ul type="disc">
96 <li>
97 <p><a id="envmem_DB_MEM_LOCK"></a>
98 <code class="literal">DB_MEM_LOCK</code>
99 </p>
100 <p>
101 Initialize locks. A thread uses this structure
102 to lock a page (or record for the QUEUE access
103 method) and hold it to the end of a transactions.
104 </p>
105 </li>
106 <li>
107 <p><a id="envmem_DB_MEM_LOCKOBJECT"></a>
108 <code class="literal">DB_MEM_LOCKOBJECT</code>
109 </p>
110 <p>
111 Initialize lock objects. For each page (or record) which
112 is locked in the system, a lock object will be allocated.
113 </p>
114 </li>
115 <li>
116 <p><a id="envmem_DB_MEM_LOCKER"></a>
117 <code class="literal">DB_MEM_LOCKER</code>
118 </p>
119 <p>
120 Initialize lockers. Each thread which is active in a
121 transactional environment will use a locker structure
122 either for each transaction which is active, or for each
123 non-transactional cursor that is active.
124 </p>
125 </li>
126 <li>
127 <p><a id="envmem_DB_MEM_LOGID"></a>
128 <code class="literal">DB_MEM_LOGID</code>
129 </p>
130 <p>
131 Initialize the log fileid structures. For each database handle
132 which is opened for writing in a transactional environment,
133 a log fileid structure is used.
134 </p>
135 </li>
136 <li>
137 <p><a id="envmem_DB_MEM_TRANSACTION"></a>
138 <code class="literal">DB_MEM_TRANSACTION</code>
139 </p>
140 <p>
141 Initialize transaction structures. Each active
142 transaction uses a transaction structure until it
143 either commits or aborts.
144 </p>
145 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
146 <h3 class="title">Note</h3>
147 <p>
148 Currently transaction structures are not
149 preallocated. This setting will be used to
150 preallocate memory and objects related to
151 transactions such as locker structures and
152 mutexes.
153 </p>
154 </div>
155 </li>
156 <li>
157 <p><a id="envmem_DB_MEM_THREAD"></a>
158 <code class="literal">DB_MEM_THREAD</code>
159 </p>
160 <p>
161 Initialize thread identification structures. If thread
162 tracking is enabled then each active thread will use a
163 structure. Note that since a thread does not signal the
164 BDB library that it will no longer be making calls, unused
165 structures may accumulate until a cleanup is triggered either
166 using a high water mark or by running
167 <a class="xref" href="envfailchk.html" title="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a>.
168 </p>
169 </li>
170 </ul>
171 </div>
172 </div>
173 <div class="sect3" lang="en" xml:lang="en">
174 <div class="titlepage">
175 <div>
176 <div>
177 <h4 class="title"><a id="idp52164872"></a>count</h4>
178 </div>
179 </div>
180 </div>
181 <p>
182 The <span class="bold"><strong>count</strong></span> parameter
183 sets the number of specified objects to initialize.
184 </p>
185 <p>
186 The <span class="bold"><strong>count</strong></span> specified for
187 locks and lock objects should be at least 5 times the
188 number of lock table partitions. You can examine the
189 current number of lock table partitions configured for your
190 environment using the
191 <a class="xref" href="envget_lk_partitions.html" title="DB_ENV-&gt;get_lk_partitions()">DB_ENV-&gt;get_lk_partitions()</a>
192 method.
193 </p>
194 </div>
195 </div>
196 <div class="sect2" lang="en" xml:lang="en">
197 <div class="titlepage">
198 <div>
199 <div>
200 <h3 class="title"><a id="idp52160504"></a>Errors</h3>
201 </div>
202 </div>
203 </div>
204 <p>
205 The <code class="methodname">DB_ENV-&gt;set_memory_init()</code> <span>
206 <span>
207 method may fail and return one of the following non-zero errors:
208 </span>
209
210 </span>
211 </p>
212 <div class="sect3" lang="en" xml:lang="en">
213 <div class="titlepage">
214 <div>
215 <div>
216 <h4 class="title"><a id="idp52149992"></a>EINVAL</h4>
217 </div>
218 </div>
219 </div>
220 <p>
221 If the method was called after <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
222 was called; or if an invalid flag value or parameter was specified.
223 </p>
224 </div>
225 </div>
226 <div class="sect2" lang="en" xml:lang="en">
227 <div class="titlepage">
228 <div>
229 <div>
230 <h3 class="title"><a id="idp52161600"></a>Class</h3>
231 </div>
232 </div>
233 </div>
234 <p>
235 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
236 </p>
237 </div>
238 <div class="sect2" lang="en" xml:lang="en">
239 <div class="titlepage">
240 <div>
241 <div>
242 <h3 class="title"><a id="idp52051000"></a>See Also</h3>
243 </div>
244 </div>
245 </div>
246 <p>
247 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
248 </p>
249 </div>
250 </div>
251 <div class="navfooter">
252 <hr />
253 <table width="100%" summary="Navigation footer">
254 <tr>
255 <td width="40%" align="left"><a accesskey="p" href="envset_isalive.html">Prev</a> </td>
256 <td width="20%" align="center">
257 <a accesskey="u" href="env.html">Up</a>
258 </td>
259 <td width="40%" align="right"> <a accesskey="n" href="envset_memory_max.html">Next</a></td>
260 </tr>
261 <tr>
262 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_isalive() </td>
263 <td width="20%" align="center">
264 <a accesskey="h" href="index.html">Home</a>
265 </td>
266 <td width="40%" align="right" valign="top"> DB_ENV-&gt;set_memory_max()</td>
267 </tr>
268 </table>
269 </div>
270 </body>
271 </html>