Debian Codegraph @

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