Hello,
I am using free-threaded BerkeleyDB handles in conjunction with
DB_DBT_USERMEM flag. My application currently relies on DBT->data
remaining unchanged in the get() call, since own buffer is specified.
Is such assumption correct?
From do***entation on DBT structure:
"By default, the flags structure element is expected to be set to 0.
In this default case, when the application is providing Berkeley DB a
key or data item to store into the database, Berkeley DB expects the
data structure element to point to a byte string of size bytes. When
returning a key/data item to the application, Berkeley DB will store
into the data structure element a pointer to a byte string of size
bytes, and the memory to which the pointer refers will be allocated
and managed by Berkeley DB."
Looking at BerkeleyDB code, I can see that no internal memory
allocation seems to be done in case DB_DBT_USERMEM is specified, and
thus I assume that DBT->data remains unchanged. But I just would like
to crosscheck if I am missing something. Reading do***entation, it is
not really clear whether application may rely on DBT->data remaining
unchanged in get() call even when DB_DBT_USERMEM flag is specified,
rather not?
Thanks for your comments.
Regards,
Alex


|