1
<!--$Id: env_set_mp_mmapsize.so,v 10.21 2001/05/15 14:44:11 bostic Exp $-->
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
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,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
11
<a name="2"><!--meow--></a>
12
<table width="100%"><tr valign=top>
14
<h1>DbEnv::set_mp_mmapsize</h1>
17
<a href="../api_cxx/cxx_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
22
#include <db_cxx.h>
25
DbEnv::set_mp_mmapsize(size_t mp_mmapsize);
28
<p>Files that are opened read-only in the pool (and that satisfy a few
29
other criteria) are, by default, mapped into the process address space
30
instead of being copied into the local cache. This can result in
31
better-than-usual performance because available virtual memory is
32
normally much larger than the local cache, and page faults are faster
33
than page copying on many systems. However, it can cause resource
34
starvation in the presence of limited virtual memory, and it can result
35
in immense process sizes in the presence of large databases.
36
<p>Set the maximum file size, in bytes, for a file to be mapped into the
37
process address space. If no value is specified, it defaults to 10MB.
38
<p>The DbEnv::set_mp_mmapsize interface may be used only to configure Berkeley DB before
39
the <a href="../api_cxx/env_open.html">DbEnv::open</a> interface is called.
40
<p>The DbEnv::set_mp_mmapsize method either returns a non-zero error value or throws an exception that
41
encapsulates a non-zero error value on failure, and returns 0 on success.
42
<p>The database environment's maximum mapped file size may also be set using the environment's
43
<b>DB_CONFIG</b> file. The syntax of the entry in that file is a
44
single line with the string "set_mp_mmapsize", one or more whitespace characters,
45
and the size in bytes. Because the <b>DB_CONFIG</b> file is read when the database
46
environment is opened, it will silently overrule configuration done
49
<p>The DbEnv::set_mp_mmapsize method may fail and throw an exception or return a non-zero error for the following conditions:
51
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
52
<p>Called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called.
54
<p>The DbEnv::set_mp_mmapsize method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.
55
If a catastrophic error has occurred, the DbEnv::set_mp_mmapsize method may fail and either
56
return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw an exception encapsulating
57
<a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, in which case all subsequent Berkeley DB calls will fail
60
<a href="../api_cxx/dbenv_class.html">DbEnv</a>, <a href="../api_cxx/mempfile_class.html">DbMpoolFile</a>
62
<a href="../api_cxx/env_set_cachesize.html">DbEnv::set_cachesize</a>,
63
<a href="../api_cxx/env_set_mp_mmapsize.html">DbEnv::set_mp_mmapsize</a>,
64
<a href="../api_cxx/memp_fclose.html">DbMpoolFile::close</a>,
65
<a href="../api_cxx/memp_fget.html">DbMpoolFile::get</a>,
66
<a href="../api_cxx/memp_fopen.html">DbMpoolFile::open</a>,
67
<a href="../api_cxx/memp_fput.html">DbMpoolFile::put</a>,
68
<a href="../api_cxx/memp_fset.html">DbMpoolFile::set</a>,
69
<a href="../api_cxx/memp_fsync.html">DbMpoolFile::sync</a>,
70
<a href="../api_cxx/memp_register.html">DbEnv::memp_register</a>,
71
<a href="../api_cxx/memp_stat.html">DbEnv::memp_stat</a>,
72
<a href="../api_cxx/memp_sync.html">DbEnv::memp_sync</a>,
74
<a href="../api_cxx/memp_trickle.html">DbEnv::memp_trickle</a>.
76
<table width="100%"><tr><td><br></td><td align=right>
77
<a href="../api_cxx/cxx_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
79
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>