[Biojava-dev] DP memory leak
Lachlan James Coin
lc1 at sanger.ac.uk
Fri Dec 19 11:19:49 EST 2003
Hi,
I came across a bit of a memory leak while using the dp code. The
problem is that AlphabetManager keeps a reference to every alphabet
created, including StateAlphabetcreated when using the dp package. I
had extended the EmissionState class in such a way that the instances
were of a non-trivial size. I am also creating (one after the other) a
lot of different state alphabets. The result was that I ran out of
memory farily quickly.
One possible fix I thought of was to add "deregisterAlphabet(name)"
method to AlphabetManager, and to call this from the finalize mehod of
SimpleMarkovModel, so that when the garbage collector thinks it can
clear the markov model the statealphabet is removed from the
AlphabetManager registry and can then also be garbage collected. Also,
it would be necessary to make alphabetToIndex a WeakHashMap.
Any other suggestions? Can I make these changes?
Thanks,
Lachlan
More information about the biojava-dev
mailing list