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: DbEnv::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>DbEnv::set_mp_mmapsize</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25DbEnv::set_mp_mmapsize(size_t mp_mmapsize); 26<p> 27int 28DbEnv::get_mp_mmapsize(size_t *mp_mmapsizep); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DbEnv::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 DbEnv::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 DbEnv::set_mp_mmapsize method configures a database environment, not only operations 51performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p> 52<p>The DbEnv::set_mp_mmapsize method may be called at any time during the life of the 53application.</p> 54<p>The DbEnv::set_mp_mmapsize method 55either returns a non-zero error value 56or throws an exception that encapsulates a non-zero error value on 57failure, and returns 0 on success. 58</p> 59<b>Parameters</b> <br> 60 <b>mp_mmapsize</b><ul compact><li>The <b>mp_mmapsize</b> parameter is the maximum file size, in bytes, 61for a file to be mapped into the process address space.</ul> 62<br> 63<br><b>Errors</b> 64<p>The DbEnv::set_mp_mmapsize method 65may fail and throw 66<a href="../api_cxx/except_class.html">DbException</a>, 67encapsulating one of the following non-zero errors, or return one of 68the following non-zero errors:</p> 69<br> 70<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called; or if an 71invalid flag value or parameter was specified.</ul> 72<br> 73<hr size=1 noshade> 74<b>Description: DbEnv::get_mp_mmapsize</b> 75<p>The DbEnv::get_mp_mmapsize method returns the maximum file map size.</p> 76<p>The DbEnv::get_mp_mmapsize method may be called at any time during the life of the 77application.</p> 78<p>The DbEnv::get_mp_mmapsize method 79either returns a non-zero error value 80or throws an exception that encapsulates a non-zero error value on 81failure, and returns 0 on success. 82</p> 83<b>Parameters</b> <br> 84 <b>mp_mmapsizep</b><ul compact><li>The DbEnv::get_mp_mmapsize method returns the 85maximum file map size in <b>mp_mmapsizep</b>.</ul> 86<br> 87<hr size=1 noshade> 88<br><b>Class</b> 89<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/mempfile_class.html">DbMpoolFile</a> 90<br><b>See Also</b> 91<a href="../api_cxx/memp_list.html">Memory Pools and Related Methods</a> 92</tt> 93<table width="100%"><tr><td><br></td><td align=right> 94<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 95</td></tr></table> 96<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 97</body> 98</html> 99