Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btr ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++

### Berkeley DB Reference Guide: Access Methods

# Non-local memory allocation (db_malloc)

It is possible in Berkeley DB to specify that returned key/data pairs be copied into allocated memory which then becomes the responsibility of the application. (See DB_DBT_MALLOC for further information.)

On systems where there may be multiple library versions of malloc (notably Windows NT), the Berkeley DB library will 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 as part of the db_open call to open the database, specifically by setting the db_malloc element of the DB_INFO structure. If no allocation function is specified, the underlying C library malloc(3) function is used.