GDBM leaks memory
Grzegorz Chrupała
grzegorz at pithekos.net
Wed Oct 27 20:46:08 CEST 2004
Hi,
I've been using the Mozart GDBM interface and I noticed that you can
store large amounts of distinct keys (say strings or integers) in a
GDBM file with no problem. However when you then iterate over those
keys, for example with GDBM.forAll or GDBM.forAllInd, Mozart seems to
leak memory. I may be wrong, but I believe it is due to the fact that
even if the keys stored were integers or strings, they are always
returned as atoms, and IIRC atoms are not garbage collected in Mozart.
So a large number of atoms is created and never collected, causing the
memory leak.
Thus a couple of the reasons I had for using using a disk based
associative datastructure such as GDBM are defeated: I used GDBM
instead of dictionaries to avoid having to convert strings to atoms,
but atoms are created anyway. I also used GDBM for very large amounts
of data to avoid having to keep them in memory, but retrieving data
from GDBM quickly eats up memory anyway.
Cheers,
--
Grzegorz Chrupała
More information about the mozart-users
mailing list