~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/docs/api_cxx/env_set_alloc.html

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!--$Id$-->
2
 
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
 
<!--All rights reserved.-->
4
 
<!--See the file LICENSE for redistribution information.-->
5
 
<html>
6
 
<head>
7
 
<title>Berkeley DB: DbEnv::set_alloc</title>
8
 
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
 
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
10
 
</head>
11
 
<body bgcolor=white>
12
 
<a name="2"><!--meow--></a>
13
 
<table width="100%"><tr valign=top>
14
 
<td>
15
 
<h1>DbEnv::set_alloc</h1>
16
 
</td>
17
 
<td align=right>
18
 
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
19
 
</td></tr></table>
20
 
<hr size=1 noshade>
21
 
<tt>
22
 
<h3><pre>
23
 
#include &lt;db_cxx.h&gt;
24
 
<p>
25
 
extern "C" {
26
 
    typedef void *(*db_malloc_fcn_type)(size_t);
27
 
    typedef void *(*db_realloc_fcn_type)(void *, size_t);
28
 
    typedef void *(*db_free_fcn_type)(void *);
29
 
};
30
 
<p>
31
 
int
32
 
DbEnv::set_alloc(db_malloc_fcn_type app_malloc,
33
 
    db_realloc_fcn_type app_realloc,
34
 
    db_free_fcn_type app_free);
35
 
</pre></h3>
36
 
<h1>Description</h1>
37
 
<p>Set the allocation functions used by the <a href="../api_cxx/env_class.html">DbEnv</a> and <a href="../api_cxx/db_class.html">Db</a>
38
 
methods to allocate or free memory owned by the application.
39
 
<p>There are a number of interfaces in Berkeley DB where memory is allocated by
40
 
the library and then given to the application.  For example, the
41
 
<a href="../api_cxx/dbt_class.html#DB_DBT_MALLOC">DB_DBT_MALLOC</a> flag, when specified in the <a href="../api_cxx/dbt_class.html">Dbt</a> object,
42
 
will cause the <a href="../api_cxx/db_class.html">Db</a> methods to allocate and reallocate memory
43
 
which then becomes the responsibility of the calling application.  (See
44
 
<a href="../api_cxx/dbt_class.html">Dbt</a> for more information.)  Other examples are the Berkeley DB
45
 
interfaces which return statistical information to the application:
46
 
<a href="../api_cxx/db_stat.html">Db::stat</a>, <a href="../api_cxx/lock_stat.html">DbEnv::lock_stat</a>, <a href="../api_cxx/log_archive.html">DbEnv::log_archive</a>,
47
 
<a href="../api_cxx/log_stat.html">DbEnv::log_stat</a>, <a href="../api_cxx/memp_stat.html">DbEnv::memp_stat</a>, and <a href="../api_cxx/txn_stat.html">DbEnv::txn_stat</a>.  There is
48
 
one interface in the Berkeley DB where memory is allocated by the application
49
 
and then given to the library: <a href="../api_cxx/db_associate.html">Db::associate</a>.
50
 
<p>On systems in which there may be multiple library versions of the
51
 
standard allocation routines (notably Windows NT), transferring memory
52
 
between the library and the application will fail because the Berkeley DB
53
 
library allocates memory from a different heap than the application uses
54
 
to free it.  To avoid this problem, the DbEnv::set_alloc and
55
 
<a href="../api_cxx/db_set_alloc.html">Db::set_alloc</a> methods can be used to pass Berkeley DB references to the
56
 
application's allocation routines.
57
 
<p>It is not an error to specify only one or two of the possible allocation
58
 
function arguments to these interfaces; however, in that case the
59
 
specified interfaces must be compatible with the standard library
60
 
interfaces, as they will be used together.  The methods specified
61
 
must match the calling conventions of the ANSI C X3.159-1989 (ANSI C) library routines
62
 
of the same name.
63
 
<p>The DbEnv::set_alloc method configures operations performed using the specified
64
 
<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
65
 
database environment.
66
 
<p>The DbEnv::set_alloc interface may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a>
67
 
interface is called.
68
 
<p>The DbEnv::set_alloc method either returns a non-zero error value or throws an exception that
69
 
encapsulates a non-zero error value on failure, and returns 0 on success.
70
 
<h1>Errors</h1>
71
 
<p>The DbEnv::set_alloc method may fail and throw an exception or return a non-zero error for the following conditions:
72
 
<p><dl compact>
73
 
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
74
 
<p>Called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called.
75
 
</dl>
76
 
<p>The DbEnv::set_alloc 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.
77
 
If a catastrophic error has occurred, the DbEnv::set_alloc method may fail and
78
 
either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a
79
 
<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>,
80
 
in which case all subsequent Berkeley DB calls will fail in the same way.
81
 
<h1>Class</h1>
82
 
<a href="../api_cxx/env_class.html">DbEnv</a>
83
 
<h1>See Also</h1>
84
 
<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
85
 
</tt>
86
 
<table width="100%"><tr><td><br></td><td align=right>
87
 
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
88
 
</td></tr></table>
89
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
90
 
</body>
91
 
</html>