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->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 8. The DB_MPOOLFILE Handle" /> 11 <link rel="prev" href="mempset_mp_max_write.html" title="DB_ENV->set_mp_max_write()" /> 12 <link rel="next" href="mempfclose.html" title="DB_MPOOLFILE->close()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DB_ENV->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 8. 23 The DB_MPOOLFILE 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>DB_ENV->set_mp_mmapsize()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->set_mp_mmapsize(DB_ENV *dbenv, 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">DB_ENV->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">DB_ENV->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 DB_ENV Handle">DB_ENV</a> handle. 70 </p> 71 <p> 72 The <code class="methodname">DB_ENV->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">DB_ENV->set_mp_mmapsize()</code> <span> 77 <span> 78 method returns a non-zero error value on failure and 0 on success. 79 </span> 80 81 </span> 82 </p> 83 <div class="sect2" lang="en" xml:lang="en"> 84 <div class="titlepage"> 85 <div> 86 <div> 87 <h3 class="title"><a id="id1689084"></a>Parameters</h3> 88 </div> 89 </div> 90 </div> 91 <div class="sect3" lang="en" xml:lang="en"> 92 <div class="titlepage"> 93 <div> 94 <div> 95 <h4 class="title"><a id="id1688880"></a>mp_mmapsize</h4> 96 </div> 97 </div> 98 </div> 99 <p> 100 The <span class="bold"><strong>mp_mmapsize</strong></span> parameter is the 101 maximum file size, in bytes, for a file to be mapped into the process 102 address space. 103 </p> 104 </div> 105 </div> 106 <div class="sect2" lang="en" xml:lang="en"> 107 <div class="titlepage"> 108 <div> 109 <div> 110 <h3 class="title"><a id="id1689236"></a>Errors</h3> 111 </div> 112 </div> 113 </div> 114 <p> 115 The <code class="methodname">DB_ENV->set_mp_mmapsize()</code> <span> 116 <span> 117 method may fail and return one of the following non-zero errors: 118 </span> 119 120 </span> 121 </p> 122 <div class="sect3" lang="en" xml:lang="en"> 123 <div class="titlepage"> 124 <div> 125 <div> 126 <h4 class="title"><a id="id1688878"></a>EINVAL</h4> 127 </div> 128 </div> 129 </div> 130 <p> 131 An invalid flag value or parameter was specified. 132 </p> 133 </div> 134 </div> 135 <div class="sect2" lang="en" xml:lang="en"> 136 <div class="titlepage"> 137 <div> 138 <div> 139 <h3 class="title"><a id="id1689138"></a>Class</h3> 140 </div> 141 </div> 142 </div> 143 <p> 144 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>, 145 <a class="link" href="memp.html" title="Chapter 8. The DB_MPOOLFILE Handle">DB_MPOOLFILE</a> 146 </p> 147 </div> 148 <div class="sect2" lang="en" xml:lang="en"> 149 <div class="titlepage"> 150 <div> 151 <div> 152 <h3 class="title"><a id="id1689050"></a>See Also</h3> 153 </div> 154 </div> 155 </div> 156 <p> 157 <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a> 158 </p> 159 </div> 160 </div> 161 <div class="navfooter"> 162 <hr /> 163 <table width="100%" summary="Navigation footer"> 164 <tr> 165 <td width="40%" align="left"><a accesskey="p" href="mempset_mp_max_write.html">Prev</a> </td> 166 <td width="20%" align="center"> 167 <a accesskey="u" href="memp.html">Up</a> 168 </td> 169 <td width="40%" align="right"> <a accesskey="n" href="mempfclose.html">Next</a></td> 170 </tr> 171 <tr> 172 <td width="40%" align="left" valign="top">DB_ENV->set_mp_max_write() </td> 173 <td width="20%" align="center"> 174 <a accesskey="h" href="index.html">Home</a> 175 </td> 176 <td width="40%" align="right" valign="top"> DB_MPOOLFILE->close()</td> 177 </tr> 178 </table> 179 </div> 180 </body> 181</html> 182