[Biojava-dev] DP memory leak

Thomas Down thomas at derkholm.net
Wed Jan 7 05:57:41 EST 2004


Once upon a time, mark.schreiber at group.novartis.com wrote:
> 
> Hi -
> 
> Does this Alphabet unloading do anything to PhredAlphabet that is created
> and registered by the PhredTools class or does it only deal with DP
> generated Alphas?
> 
> General question: Is there any reason why the DP generated Alpha needs to
> be registered with the AlphabetManager? Presumably not registering would
> prevent memory leaks?

As far as I can tell, MarkovModel alphabets never get registered,
so that isn't the cause of the leak.  The problem was due to the
way AlphabetManager caches AlphabetIndex objects -- that was
preventing any alphabet which had ever been used in a Distribution
from ever unloading.  I've added lots of WeakReferences, and that
side of things is working fine now.

(Although I think there might also be a second DP-related memory
leak.  Investigating now).

> Also, there is currently no way to deregister an Alphabet from
> AlphabetManager. Adding that functionality may be useful (even if not
> needed for this case). Might be good to allow exception throwing if people
> try to unload something that shouldn't be. For BioJava2 it might be good to
> allow change veto exceptions or similar to the register and deregister
> methods. The current registerAlphabet method simply overwrites the previous
> object associated with that name.

Agreed.

Actually, for BJ2, I think we should try to eliminate special-purpose
registries like AlphabetManager entirely, and have a single API (preferably
JNDI) for retriving *any* named resource.  That way, we just have
one interface for registering resources, too, which should simplify
policy issues like this.

      Thomas.


More information about the biojava-dev mailing list