news:<99805581.0309301348.327a7567@posting.google.com>...
> I was able to get my previous email to work (I could not reply to it
> directly using google.) by using DB_DBT_MALLOC/DB_DBT_REALLOC.
>
> I have more questions:
>
> Are we required to free a DBT if we use DB_DBT_MALLOC/DB_DBT_REALLOC?
> or will BerkeleyDB do this for us?


The application must free the memory referenced by the key or
data pointers when these flags are used. The memory allocated
when these flags are used is the responsibility of the application.

> If I memset a DBT to 0, when I previously set the flag to
> DB_DBT_MALLOC and populated the DBT with a DB->get, will BerkeleyDB
> free that memory?


No. Any pointer allocated based on the DB_DBT_MALLOC flag
will never be freed by Berkeley DB.

> If I use DB_DBT_REALLOC, do I initially have to use DB_DBT_MALLOC,
> then after I have populated the DBT, set the DBT flag to
> DB_DBT_REALLOC?


You can use DB_DBT_REALLOC initially, without first using
DB_DBT_MALLOC.

Regards,
--keith