<!--$Id: malloc.so,v 10.19 2000/03/18 21:43:09 bostic Exp $--><!--Copyright 1997, 1998, 1999, 2000 by Sleepycat Software, Inc.--><!--All rights reserved.--><html><head><title>Berkeley DB Reference Guide: Non-local memory allocation</title><metaname="description"content="Berkeley DB: An embedded database programmatic toolkit."><metaname="keywords"content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"></head><bodybgcolor=white><table><trvalign=top><td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></h3></td><tdwidth="1%"><ahref="../../ref/am_conf/dup.html"><imgsrc="../../images/prev.gif"alt="Prev"></a><ahref="../../ref/toc.html"><imgsrc="../../images/ref.gif"alt="Ref"></a><ahref="../../ref/am_conf/bt_compare.html"><imgsrc="../../images/next.gif"alt="Next"></a></td></tr></table><p><h1align=center>Non-local memory allocation</h1><p>Berkeley DB can allocate memory for returned key/data pairs which then becomesthe responsibility of the application. See <ahref="../../api_c/dbt.html#DB_DBT_MALLOC">DB_DBT_MALLOC</a> or<ahref="../../api_c/dbt.html#DB_DBT_REALLOC">DB_DBT_REALLOC</a> for further information.<p>On systems where there may be multiple library versions of malloc (notablyWindows NT), the Berkeley DB library could allocate memory from a different heapthan the application will use to free it. To avoid this problem, theallocation routine to be used for allocating such key/data items can bespecified by calling the <ahref="../../api_c/db_set_malloc.html">DB->set_malloc</a> or<ahref="../../api_c/db_set_realloc.html">DB->set_realloc</a> functions. If no allocation function is specified, theunderlying C library functions are used.<table><tr><td><br></td><tdwidth="1%"><ahref="../../ref/am_conf/dup.html"><imgsrc="../../images/prev.gif"alt="Prev"></a><ahref="../../ref/toc.html"><imgsrc="../../images/ref.gif"alt="Ref"></a><ahref="../../ref/am_conf/bt_compare.html"><imgsrc="../../images/next.gif"alt="Next"></a></td></tr></table><p><fontsize=1><ahref="http://www.sleepycat.com">Copyright Sleepycat Software</a></font></body></html>