[Bioperl-l] Memory leak in Bio::Root::Root?
Jason Stajich
jason.stajich at duke.edu
Tue Dec 13 23:19:37 EST 2005
polyn returns a scalar object (blessed) or just some scalar data?
If you are really calling QStat->polyn( $obj) then 'new' is never
called in the first place for the Qstat package.
Destructors are automatic, but you can create your own to see when/if
the destructor is called.
sub DESTROY {
my $self =shift;
warn("I am calling destroy in the Qstat object\n");
$self->SUPER::DESTROY;
}
You can also inherit from Bio::Root::RootI and call bless on your own
if you want to play with whether this is Bio::Root::Root induced
behavior. I'm not sure I understand enough of how it works to tell
you where else to look.
Is a new $seq_obj getting created every iteration of the loop? Are
these getting cleaned up or is Qstat keeping references to them, and
they are sticking around? Devel::Cycle doesn't show any memory cycles?
On Dec 13, 2005, at 11:32 AM, Mike Muratet wrote:
> Greetings all
>
> I have a problem that surpasses what I know and what I've been able
> to glean from perltoot,perboot,etc. Maybe it's a question for a
> perl list, but here goes...
>
> I was given a package that calculates some statistics regarding
> base repeats in a sequence. It inherits from Bio::Root::Root
> presumbably to obtain the exception behavior bestowed by the class
> judging from the perldocs and to enforce that the argument is a
> PrimarySeq object. It has
> two methods which get called thus:
>
> my $polyn = QStat->polyn($seq_obj);
> my $nstat = QStat->nmer_stat($seq_obj);
>
> where the returned values are scalar references. The problem is
> that script quickly uses up all of the 4GB address space
> (processing lots of oligos) and crashes.
>
> I have used Devel::Size to determine the size of these variables
> and get 3.8K and 7K. I have tried to undef them at the end of the
> loop but it has no effect. I commented out the calls and the
> problem goes away so the problem is associated with the QStat object.
>
> The QStat class has a constructor that calls the base constructor:
> my $self = $class->SUPER::new(@args);
> would this demand a destructor somewhere?
>
> Does calling a method out of a class like this invoke all the class
> machinery without creating the object with new?
>
> Can someone with experience deriving from Bio::Root::Root offer
> some suggestions on how to get the memory back?
>
> Thanks
>
> Mike
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
--
Jason Stajich
Duke University
http://www.duke.edu/~jes12
More information about the Bioperl-l
mailing list