[Biojava-l] Potential memory leak in ChangeSupport

Thomas Down td2@sanger.ac.uk
Tue, 5 Dec 2000 15:46:46 +0000


Hi...

Just realized that there is a potential memory leak, since
ChangeSupport was keeping strong references to all change
listener objects.  This means that if an object (for instance
a whole-chromosome SymbolList) is listening to a `root' object
like the DNA Alphabet, there is no chance of it ever getting
garbage-collected -- ooops!

We've fixed this for now by using WeakReferences in ChangeSupport.
Hopefully this one change will fix all potential memory leaks.
However, if anyone wants to write their own change-event
sources which /don't/ use ChangeSupport, please beware of this
potential problem.  In practice, ChangeSupport should be the
right solution for 99.9% of situtations anyway.

Happy hacking,

   Thomas.
-- 
``If I was going to carry a large axe on my back to a diplomatic
function I think I'd want it glittery too.''
           -- Terry Pratchett