1<!--$Id: env_set_mp_mmapsize.so,v 10.40 2004/09/28 15:04:21 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;set_mp_mmapsize</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;set_mp_mmapsize</b>
14</td>
15<td align=right>
16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;set_mp_mmapsize(DB_ENV *dbenv, size_t mp_mmapsize);
26<p>
27int
28DB_ENV-&gt;get_mp_mmapsize(DB_ENV *dbenv, size_t *mp_mmapsizep);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;set_mp_mmapsize</b>
32<p>Files that are opened read-only in the pool (and that satisfy a few
33other criteria) are, by default, mapped into the process address space
34instead of being copied into the local cache.  This can result in
35better-than-usual performance because available virtual memory is
36normally much larger than the local cache, and page faults are faster
37than page copying on many systems.  However, it can cause resource
38starvation in the presence of limited virtual memory, and it can result
39in immense process sizes in the presence of large databases.</p>
40<p>The DB_ENV-&gt;get_mp_mmapsize method sets the maximum file size, in bytes,
41for a file to be mapped into the process address space.  If no value is
42specified, it defaults to 10MB.</p>
43<p>The database environment's maximum mapped file size may also be configured using the
44environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
45file is a single line with the string "set_mp_mmapsize", one or more whitespace
46characters, and the size in bytes.
47Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
48is opened, it will silently overrule configuration done before that
49time.</p>
50<p>The DB_ENV-&gt;set_mp_mmapsize method configures a database environment, not only operations
51performed using the specified <a href="../api_c/env_class.html">DB_ENV</a> handle.</p>
52<p>The DB_ENV-&gt;set_mp_mmapsize method may be called at any time during the life of the
53application.</p>
54<p>The DB_ENV-&gt;set_mp_mmapsize method
55returns a non-zero error value on failure
56and 0 on success.
57</p>
58<b>Parameters</b> <br>
59 <b>mp_mmapsize</b><ul compact><li>The <b>mp_mmapsize</b> parameter is the maximum file size, in bytes,
60for a file to be mapped into the process address space.</ul>
61<br>
62<br><b>Errors</b>
63<p>The DB_ENV-&gt;set_mp_mmapsize method
64may fail and return one of the following non-zero errors:</p>
65<br>
66<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> was called; or if an
67invalid flag value or parameter was specified.</ul>
68<br>
69<hr size=1 noshade>
70<b>Description: DB_ENV-&gt;get_mp_mmapsize</b>
71<p>The DB_ENV-&gt;get_mp_mmapsize method returns the maximum file map size.</p>
72<p>The DB_ENV-&gt;get_mp_mmapsize method may be called at any time during the life of the
73application.</p>
74<p>The DB_ENV-&gt;get_mp_mmapsize method
75returns a non-zero error value on failure
76and 0 on success.
77</p>
78<b>Parameters</b> <br>
79 <b>mp_mmapsizep</b><ul compact><li>The DB_ENV-&gt;get_mp_mmapsize method returns  the
80maximum file map size in <b>mp_mmapsizep</b>.</ul>
81<br>
82<hr size=1 noshade>
83<br><b>Class</b>
84<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/mempfile_class.html">DB_MPOOLFILE</a>
85<br><b>See Also</b>
86<a href="../api_c/memp_list.html">Memory Pools and Related Methods</a>
87</tt>
88<table width="100%"><tr><td><br></td><td align=right>
89<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
90</td></tr></table>
91<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
92</body>
93</html>
94