Berkeley DB: DbInfo::set_malloc
Полезная информация


#include <db_cxx.h>

typedef void *(*db_malloc_fcn)(size_t); void DbInfo::set_malloc(db_malloc_fcn);


Set the malloc function used by the Db methods.

The DB_DBT_MALLOC flag, when specified in the Dbt object, will cause the Db methods to 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 malloc function should be set to point to the application's allocation routine. If malloc is not explicitly set, it will be used to allocate the memory returned when the DB_DBT_MALLOC flag is set. The malloc method must match the calling conventions of the malloc(3) library routine.



See Also

DbInfo::set_bt_compare, DbInfo::set_bt_maxkey, DbInfo::set_bt_minkey, DbInfo::set_bt_prefix, DbInfo::set_cachesize, DbInfo::set_compare, DbInfo::set_flags, DbInfo::set_h_ffactor, DbInfo::set_h_hash, DbInfo::set_h_nelem, DbInfo::set_lorder, DbInfo::set_malloc, DbInfo::set_pagesize, DbInfo::set_re_delim, DbInfo::set_re_len, DbInfo::set_re_pad and DbInfo::set_re_source.