[Bioperl-l] Memory leak in Bio::SeqIO::staden::read->staden_read_trace() ?

Adam Sjøgren adsj at novozymes.com
Wed Feb 8 07:28:11 EST 2012


  Hi.

I am using Bio::SeqIO(staden::read) to read .ab1 files in a long lived
(daemon) process, and I have noticed that memory usage keeps growing
somewhat rapidly.

I have thrown together a small script that illustrates what I am seeing:

#!/usr/bin/perl

# test.pl - illustrate possible memory leak in Bio::SeqIO::staden::read->staden_read_trace
#           Example .ab1 file found via first hit on Google: http://www.elimbio.com/Forms/pGEM.zip

use strict;
use warnings;

use Bio::SeqIO;

while (1) {
    print "Reading 100 times\n";
    for my $i (1 .. 100) {
        my $in=Bio::SeqIO->new(-file=>'pGEM_(ABI)_A01.ab1', -format=>'abi');
        my $seq=$in->next_seq(); # This seems to leak memory
    }
    print "Sleeping\n";
    sleep 5;
}

Running this, and running 'while (( 1 )); do ps fauxww | grep [t]est.pl;
sleep 2; done;' I see an increase of memory usage by ~30MB per 100 read
cycle; e.g. 108660, 140260, 171860, 203460, 235064, 266676 bytes.

I would have expected the number to level out as $seq goes out of scope
and memory is returned to Perls internal pool for reuse.

If I comment out the $self->staden_read_trace() in L104 of
Bio::SeqIO::staden::read then memory usage stays constant, which leads
me to believe that it might be leaking (rather than some circular
reference I'm overlooking).

I am wondering if anyone can reproduce this problem, or if it is a local
thing (I had to do some gymnastics to build bioperl-ext way-back-when,
so it isn't entirely impossible); if anyone could try it and report
back, that would be a great help.

I am using BioPerl 1.6.1, bioperl-ext 1.5.1 and perl 5.10.1 on Ubuntu
10.04.03 lucid amd64.

  Best regards,

    Adam

-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com



More information about the Bioperl-l mailing list