Berkeley DB Reference Guide:
  Access Methods

Non-local memory allocation

Berkeley DB allocates memory for returning key/data pairs and statistical information which becomes the responsibility of the application. There are also interfaces where an application will allocate memory which becomes the responsibility of Berkeley DB.

On systems in which there may be multiple library versions of the standard allocation routines (notably Windows NT), transferring memory between the library and the application will fail because the Berkeley DB library allocates memory from a different heap than the application uses to free it, or vice versa. To avoid this problem, the DB_ENV->set_alloc and DB->set_alloc methods can be used to give Berkeley DB references to the application's allocation routines.

Copyright (c) 1996,2008 Oracle. All rights reserved.