[Bioperl-l] Seeking comments, Bio::Species memleak fix

Chris Fields cjfields at illinois.edu
Wed Jun 30 17:35:51 UTC 2010


All,

I have a branch in github (topic/species_proxy) that converts
Bio::Species into a proxy class.  This appears to fix a ton of problems
introduced during the Tree/Taxonomy refactoring a few years back.

Advantages:

1) No need for Scalar::Util::weaken within Bio::Species or
Bio::Tree::Node.  Cleanup methods are handled during instance
destruction.

2) This paves the way a bit more for eventual deprecation of
Bio::Species in 1.7.

3) Works with bioperl-db and BioSQL as is (passes on both my local
Ubuntu 9.10 and Mac OS X 10.6), perl 5.10 and 5.12, should work with
earlier perl versions.

Disadvantages:

1) For every Bio::Species, we have a Bio::Taxon, a Bio::Tree::Tree, and
a Bio::DB::Taxonomy (one instance more than the previous Bio::Species
implementation).  We can probably reduce that down considerably by
creating the needed instances lazily.

This fixes:

bug 3017  use threads to get genbank file error
bug 2594  Bio::Species memory leak

and possibly others:

bug 2773  Bio::Tree::Node gets destroyed even though it is still live

If there are no comments, I'll merge this with the master branch in the
next few days.

++++++++++++++++++++++++++++++++++++++++++

(NOTE: skip the next two paragraphs if you don't want to read nasty
implementation details)

Bio::Species had previously inherited from Bio::Taxon, but also required
it to hold a Bio::Tree::Tree which contained a circular reference back
to the Bio::Species object, thus requiring Scalar::Util::weaken.  This
has caused several hard-to-diagnose problems with premature garbage
collection, including some issues with threads (bug 3017).  

The above proxy fix converts Bio::Species into a proxy class, which only
inherits the interface (Bio::Tree::NodeI), and delegates to an internal
Bio::Taxon and a Bio::Tree::Tree.  Neither contained object has a
reference back to the Bio::Species instance, thus the class can perform
proper garbage collection.  

chris




More information about the Bioperl-l mailing list