| 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_max()</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_memory_init.html" title="DbEnv::set_memory_init()" /> |
| 12 | <link rel="next" href="envset_metadata_dir.html" title="DbEnv::set_metadata_dir()" /> |
| 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_max()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_memory_init.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_metadata_dir.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_max"></a>DbEnv::set_memory_max()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbEnv::set_memory_max(u_int32_t gbytes, u_int32_t bytes); </pre> |
| 45 | <p> |
| 46 | This method sets the maximum amount of memory to be used by shared |
| 47 | structures in the main environment region. These are the |
| 48 | structures used to coordinate access to the environment other than |
| 49 | mutexes and those in the page cache (memory pool). If the region |
| 50 | files are in memory mapped files, or if |
| 51 | <code class="literal">DB_PRIVATE</code> is specified, the memory specified by |
| 52 | this method is not allocated completely at startup. As memory is |
| 53 | needed, the shared region will be extended or, in the case of |
| 54 | <code class="literal">DB_PRIVATE</code>, more memory will be allocated using |
| 55 | the system malloc call. For memory mapped files, a mapped region |
| 56 | will be allocated to this size but the underlying file will only be |
| 57 | allocated sufficient memory to hold the initial allocation of |
| 58 | shared memory structures as set by |
| 59 | <a class="xref" href="envset_memory_init.html" title="DbEnv::set_memory_init()">DbEnv::set_memory_init()</a>. |
| 60 | </p> |
| 61 | <p> |
| 62 | If no memory maximum is specified then it is calculated from |
| 63 | defaults, initial settings or (deprecated) maximum settings of the |
| 64 | various shared structures. In the case of environments created |
| 65 | with <code class="literal">DB_PRIVATE</code>, no maximum need be set and the |
| 66 | shared structure allocation will grow as needed until the process |
| 67 | memory limit is exhausted. |
| 68 | </p> |
| 69 | <p> |
| 70 | The database environment's maximum memory may also be configured |
| 71 | using the environment's |
| 72 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> |
| 73 | file. The syntax of the entry in that file is a single line with |
| 74 | the string "set_memory_max", one or more whitespace characters, |
| 75 | followed by the maximum to be allocated. Because the |
| 76 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> |
| 77 | file is read when the database environment is opened, it will |
| 78 | silently overrule configuration done before that time. |
| 79 | </p> |
| 80 | <p> |
| 81 | The <code class="methodname">DbEnv::set_memory_max()</code> method must be |
| 82 | called prior to opening the database environment. |
| 83 | </p> |
| 84 | <div class="sect2" lang="en" xml:lang="en"> |
| 85 | <div class="titlepage"> |
| 86 | <div> |
| 87 | <div> |
| 88 | <h3 class="title"><a id="idp7531776"></a>Parameters</h3> |
| 89 | </div> |
| 90 | </div> |
| 91 | </div> |
| 92 | <div class="sect3" lang="en" xml:lang="en"> |
| 93 | <div class="titlepage"> |
| 94 | <div> |
| 95 | <div> |
| 96 | <h4 class="title"><a id="idp7531968"></a>gbytes</h4> |
| 97 | </div> |
| 98 | </div> |
| 99 | </div> |
| 100 | <p> |
| 101 | The maximum memory is set to |
| 102 | <span class="bold"><strong>gbytes</strong></span> gigabytes plus |
| 103 | <span class="bold"><strong>bytes</strong></span>. |
| 104 | </p> |
| 105 | </div> |
| 106 | <div class="sect3" lang="en" xml:lang="en"> |
| 107 | <div class="titlepage"> |
| 108 | <div> |
| 109 | <div> |
| 110 | <h4 class="title"><a id="idp7501072"></a>bytes</h4> |
| 111 | </div> |
| 112 | </div> |
| 113 | </div> |
| 114 | <p> |
| 115 | The maximum memory is set to |
| 116 | <span class="bold"><strong>gbytes</strong></span> gigabytes plus |
| 117 | <span class="bold"><strong>bytes</strong></span>. |
| 118 | </p> |
| 119 | </div> |
| 120 | </div> |
| 121 | <div class="sect2" lang="en" xml:lang="en"> |
| 122 | <div class="titlepage"> |
| 123 | <div> |
| 124 | <div> |
| 125 | <h3 class="title"><a id="idp7472600"></a>Errors</h3> |
| 126 | </div> |
| 127 | </div> |
| 128 | </div> |
| 129 | <p> |
| 130 | The <code class="methodname">DbEnv::set_memory_max()</code> <span> |
| 131 | |
| 132 | <span> |
| 133 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 134 | exception, encapsulating one of the following non-zero errors, or return one |
| 135 | of the following non-zero errors: |
| 136 | </span> |
| 137 | </span> |
| 138 | </p> |
| 139 | <div class="sect3" lang="en" xml:lang="en"> |
| 140 | <div class="titlepage"> |
| 141 | <div> |
| 142 | <div> |
| 143 | <h4 class="title"><a id="idp7536432"></a>EINVAL</h4> |
| 144 | </div> |
| 145 | </div> |
| 146 | </div> |
| 147 | <p> |
| 148 | If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> |
| 149 | was called; or if an invalid flag value or parameter was specified. |
| 150 | </p> |
| 151 | </div> |
| 152 | </div> |
| 153 | <div class="sect2" lang="en" xml:lang="en"> |
| 154 | <div class="titlepage"> |
| 155 | <div> |
| 156 | <div> |
| 157 | <h3 class="title"><a id="idp7473960"></a>Class</h3> |
| 158 | </div> |
| 159 | </div> |
| 160 | </div> |
| 161 | <p> |
| 162 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 163 | </p> |
| 164 | </div> |
| 165 | <div class="sect2" lang="en" xml:lang="en"> |
| 166 | <div class="titlepage"> |
| 167 | <div> |
| 168 | <div> |
| 169 | <h3 class="title"><a id="idp7515344"></a>See Also</h3> |
| 170 | </div> |
| 171 | </div> |
| 172 | </div> |
| 173 | <p> |
| 174 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 175 | </p> |
| 176 | </div> |
| 177 | </div> |
| 178 | <div class="navfooter"> |
| 179 | <hr /> |
| 180 | <table width="100%" summary="Navigation footer"> |
| 181 | <tr> |
| 182 | <td width="40%" align="left"><a accesskey="p" href="envset_memory_init.html">Prev</a> </td> |
| 183 | <td width="20%" align="center"> |
| 184 | <a accesskey="u" href="env.html">Up</a> |
| 185 | </td> |
| 186 | <td width="40%" align="right"> <a accesskey="n" href="envset_metadata_dir.html">Next</a></td> |
| 187 | </tr> |
| 188 | <tr> |
| 189 | <td width="40%" align="left" valign="top">DbEnv::set_memory_init() </td> |
| 190 | <td width="20%" align="center"> |
| 191 | <a accesskey="h" href="index.html">Home</a> |
| 192 | </td> |
| 193 | <td width="40%" align="right" valign="top"> DbEnv::set_metadata_dir()</td> |
| 194 | </tr> |
| 195 | </table> |
| 196 | </div> |
| 197 | </body> |
| 198 | </html> |