[Rpm-maint] rpmdbNextIterator: memory leakage?
Panu Matilainen
pmatilai at redhat.com
Fri Dec 21 08:13:29 UTC 2007
On Wed, 19 Dec 2007, Pazzo Da Legare wrote:
> Dear All again,
>
> In my previous message I asked about querying and freeing
> resource....while I'm waiting for your help I'm still doing some test.
> Surely I'm wrong but it seems to me there is a memory leakage in the
> rpmdbNextIterator()....in my configuration it leaks 990 bytes each
> time I call the function dumpPackages...or probably I'm wrong...
Hmm.. I can't reproduce that signature related leak. What version of rpm
is this?
A few general comments:
- There's no need to explicitly open and close the rpmdb, it'll get lazily
opened when needed and closed in rpmtsFree().
- You don't want to do generic rpm setup and open + closing of rpmdb in a
loop. rpmReadConfigFiles() only needs to be called once in a program
normally, and open+close of rpmdb isn't really a "free" operation so
avoid repeating it unnecessarily. Create a transaction set, do
everything you plan on doing on that single ts and then close it when
done.
BTW to fully clean up the rpm environment you'll need to call various
cleanup functions: rpmFreeRpmrc(), rpmFreeMacros() and whatnot, but these
only show up in "still reachable" leaks in valgrind.
- Panu -
More information about the Rpm-maint
mailing list