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_mp_mmapsize()</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="memp.html" title="Chapter��9.�� The DbMpoolFile Handle" /> 11 <link rel="prev" href="mempset_mp_max_write.html" title="DbEnv::set_mp_max_write()" /> 12 <link rel="next" href="mempfclose.html" title="DbMpoolFile::close()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::set_mp_mmapsize()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="mempset_mp_max_write.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��9.�� 23 The DbMpoolFile Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="mempfclose.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="envset_mp_mmapsize"></a>DbEnv::set_mp_mmapsize()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::set_mp_mmapsize(size_t mp_mmapsize); </pre> 42 <p> 43 Files that are opened read-only in the cache (and that satisfy a few 44 other criteria) are, by default, mapped into the process address space 45 instead of being copied into the local cache. This can result in 46 better-than-usual performance because available virtual memory is 47 normally much larger than the local cache, and page faults are faster 48 than page copying on many systems. However, it can cause resource 49 starvation in the presence of limited virtual memory, and it can 50 result in immense process sizes in the presence of large databases. 51 </p> 52 <p> 53 The <code class="methodname">DbEnv::set_mp_mmapsize()</code> method sets the maximum file size, in 54 bytes, for a file to be mapped into the process address space. If no 55 value is specified, it defaults to 10MB. 56 </p> 57 <p> 58 The database environment's maximum mapped file size may also be 59 configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 60 syntax of the entry in that file is a single line with the string 61 "set_mp_mmapsize", one or more whitespace characters, and the size in 62 bytes. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 63 read when the database environment is opened, it will silently 64 overrule configuration done before that time. 65 </p> 66 <p> 67 The <code class="methodname">DbEnv::set_mp_mmapsize()</code> method configures a database 68 environment, not only operations performed using the specified 69 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> handle. 70 </p> 71 <p> 72 The <code class="methodname">DbEnv::set_mp_mmapsize()</code> method may be called at any time during 73 the life of the application. 74 </p> 75 <p> 76 The <code class="methodname">DbEnv::set_mp_mmapsize()</code> <span> 77 78 <span> 79 method either returns a non-zero error value or throws an 80 exception that encapsulates a non-zero error value on 81 failure, and returns 0 on success. 82 </span> 83 </span> 84 </p> 85 <div class="sect2" lang="en" xml:lang="en"> 86 <div class="titlepage"> 87 <div> 88 <div> 89 <h3 class="title"><a id="id1693260"></a>Parameters</h3> 90 </div> 91 </div> 92 </div> 93 <div class="sect3" lang="en" xml:lang="en"> 94 <div class="titlepage"> 95 <div> 96 <div> 97 <h4 class="title"><a id="id1693422"></a>mp_mmapsize</h4> 98 </div> 99 </div> 100 </div> 101 <p> 102 The <span class="bold"><strong>mp_mmapsize</strong></span> parameter is the 103 maximum file size, in bytes, for a file to be mapped into the process 104 address space. 105 </p> 106 </div> 107 </div> 108 <div class="sect2" lang="en" xml:lang="en"> 109 <div class="titlepage"> 110 <div> 111 <div> 112 <h3 class="title"><a id="id1693261"></a>Errors</h3> 113 </div> 114 </div> 115 </div> 116 <p> 117 The <code class="methodname">DbEnv::set_mp_mmapsize()</code> <span> 118 119 <span> 120 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 121 exception, encapsulating one of the following non-zero errors, or return one 122 of the following non-zero errors: 123 </span> 124 </span> 125 </p> 126 <div class="sect3" lang="en" xml:lang="en"> 127 <div class="titlepage"> 128 <div> 129 <div> 130 <h4 class="title"><a id="id1693396"></a>EINVAL</h4> 131 </div> 132 </div> 133 </div> 134 <p> 135 An invalid flag value or parameter was specified. 136 </p> 137 </div> 138 </div> 139 <div class="sect2" lang="en" xml:lang="en"> 140 <div class="titlepage"> 141 <div> 142 <div> 143 <h3 class="title"><a id="id1693395"></a>Class</h3> 144 </div> 145 </div> 146 </div> 147 <p> 148 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a>, 149 <a class="link" href="memp.html" title="Chapter��9.�� The DbMpoolFile Handle">DbMpoolFile</a> 150 </p> 151 </div> 152 <div class="sect2" lang="en" xml:lang="en"> 153 <div class="titlepage"> 154 <div> 155 <div> 156 <h3 class="title"><a id="id1693525"></a>See Also</h3> 157 </div> 158 </div> 159 </div> 160 <p> 161 <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a> 162 </p> 163 </div> 164 </div> 165 <div class="navfooter"> 166 <hr /> 167 <table width="100%" summary="Navigation footer"> 168 <tr> 169 <td width="40%" align="left"><a accesskey="p" href="mempset_mp_max_write.html">Prev</a>��</td> 170 <td width="20%" align="center"> 171 <a accesskey="u" href="memp.html">Up</a> 172 </td> 173 <td width="40%" align="right">��<a accesskey="n" href="mempfclose.html">Next</a></td> 174 </tr> 175 <tr> 176 <td width="40%" align="left" valign="top">DbEnv::set_mp_max_write()��</td> 177 <td width="20%" align="center"> 178 <a accesskey="h" href="index.html">Home</a> 179 </td> 180 <td width="40%" align="right" valign="top">��DbMpoolFile::close()</td> 181 </tr> 182 </table> 183 </div> 184 </body> 185</html> 186