Subject: Re: Memory management in libdb routines
To: Peter Simons <peter.simons@gmd.de>
From: Zdenek Salvet <salvet@ics.muni.cz>
List: port-i386
Date: 08/25/1998 08:30:51
> pardon me if this question is a bit off the track for this mailing
> list, but I couldn't really think of a better place to ask, so here it
> goes:
> 
> If I retrieve a key/data pair from a DB-file using the get() method, I
> receive the data in a DBT structure. Since I provided the structure
> itself when calling get(), I am obviously responsible for free()ing it
> when I don't need it anymore, but who is responsible for free()ing the
> data contained in the structure?

AFAIK, data belong to the library.

> Me? The library? When does it free it
> in that case? Must I copy the data into my own memory before calling a
> libdb routine again?

Yes.

-- 
Zdenek Salvet                                              salvet@ics.muni.cz 
----------------------------------------------------------------------------
           If God had meant for us to be in the Army,
         we would have been born with green, baggy skin.