<!--$Id: alloc.so,v 1.12 2004/08/13 03:39:00 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Release 3.3: DB->set_malloc, DB->set_realloc</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> <td align=right><a href="../upgrade.3.3/getswap.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../upgrade.3.3/conflict.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p> <h3 align=center>Release 3.3: DB->set_malloc, DB->set_realloc</h3> <p>There are two new methods in the Berkeley DB 3.3 release: <a href="../../api_c/env_set_alloc.html">DB_ENV->set_alloc</a> and <a href="../../api_c/db_set_alloc.html">DB->set_alloc</a>. These functions allow applications to specify a set of allocation functions for the Berkeley DB library to use when allocating memory to be owned by the application and when freeing memory that was originally allocated by the application.</p> <p>The new methods affect or replace the following historic methods:</p> <dl compact> <dt>DB->set_malloc<dd>The DB->set_malloc method has been replaced in its entirety. Applications using this method should replace the call with a call to <a href="../../api_c/db_set_alloc.html">DB->set_alloc</a>. <dt>DB->set_realloc<dd>The DB->set_realloc method has been replaced in its entirety. Applications using this method should replace the call with a call to <a href="../../api_c/db_set_alloc.html">DB->set_alloc</a>. <dt><a href="../../api_c/db_stat.html">DB->stat</a><dd>The historic <b>db_malloc</b> argument to the <a href="../../api_c/db_stat.html">DB->stat</a> method has been replaced. Applications using this method should do as follows: if the argument is NULL, it should simply be removed. If non-NULL, it should be replaced with a call to <a href="../../api_c/db_set_alloc.html">DB->set_alloc</a>. <dt>lock_stat<dd>The historic <b>db_malloc</b> argument to the lock_stat function has been replaced. Applications using this function should do as follows: if the argument is NULL, it should simply be removed. If non-NULL, it should be replaced with a call to <a href="../../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>. <dt>log_archive<dd>The historic <b>db_malloc</b> argument to the log_archive function has been replaced. Applications using this function should do as follows: if the argument is NULL, it should simply be removed. If non-NULL, it should be replaced with a call to <a href="../../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>. <dt>log_stat<dd>The historic <b>db_malloc</b> argument to the log_stat function has been replaced. Applications using this function should do as follows: if the argument is NULL, it should simply be removed. If non-NULL, it should be replaced with a call to <a href="../../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>. <dt>memp_stat<dd>The historic <b>db_malloc</b> argument to the memp_stat function has been replaced. Applications using this function should do as follows: if the argument is NULL, it should simply be removed. If non-NULL, it should be replaced with a call to <a href="../../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>. <dt>txn_stat<dd>The historic <b>db_malloc</b> argument to the txn_stat function has been replaced. Applications using this function should do as follows: if the argument is NULL, it should simply be removed. If non-NULL, it should be replaced with a call to <a href="../../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>. </dl> <p>One potential incompatibility for historic applications is that the allocation functions for a database environment must now be set before the environment is opened. Historically, Berkeley DB applications could open the environment first, and subsequently call the DB->set_malloc and DB->set_realloc methods; that use is no longer supported.</p> <table width="100%"><tr><td><br></td><td align=right><a href="../upgrade.3.3/getswap.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../upgrade.3.3/conflict.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>