### Berkeley DB Reference Guide: Access Methods |

# Non-local memory allocation

Berkeley DB can allocate memory for returned key/data pairs which then becomes the responsibility of the application. See DB_DBT_MALLOC or DB_DBT_REALLOC for further information.

On systems where there may be multiple library versions of malloc (notably Windows NT), the Berkeley DB library could allocate memory from a different heap than the application will use to free it. To avoid this problem, the allocation routine to be used for allocating such key/data items can be specified by calling the DB->set_malloc or DB->set_realloc functions. If no allocation function is specified, the underlying C library functions are used.

Copyright Sleepycat Software