DB->set_malloc(DB *db, void *(*db_malloc)(size_t size));
Set the allocation function used by the DB methods to allocate
memory in which to return key/data items to the application.
The DB_DBT_MALLOC flag, when specified in the DBT object,
will cause the DB methods to allocate and re-allocate memory which
then becomes the responsibility of the calling application. See DBT
for more information.
On systems where there may be multiple library versions of malloc (notably
Windows NT), specifying the DB_DBT_MALLOC flag will fail because
the DB library will allocate memory from a different heap than
the application will use to free it. To avoid this problem, the
DB->set_malloc function can be used to pass Berkeley DB a reference to the
application's allocation routine, in which case it will be used to
allocate the memory returned when the DB_DBT_MALLOC flag is set.
The function specified must match the calling conventions of the
ANSI C X3.159-1989 (ANSI C) library routine of the same name.
The DB->set_malloc interface may only be used to configure Berkeley DB before
the DB->open interface is called.
The DB->set_malloc function returns a non-zero error value on failure and 0 on success.