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

« back to all changes in this revision

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