Skip to content

Memory leak: Bio::DB::HTS::Tabix - very reproducible

Created by: keiranmraine

Use the following small bit of code to reproduce with a tabix indexed BED file:

#!/usr/bin/perl
use strict;
use Bio::DB::HTS::Tabix;

my ($file, $search, $iterations) = @ARGV;

my $brass_np = Bio::DB::HTS::Tabix->new(filename => $file);

for(0..$iterations) {
  my $iter = $brass_np->query($search);
  while(my $record = $iter->next){ }
}

Example runs (coordinate must hit records):

$ /usr/bin/time -f '%Mk maxresident' perl htsTabix_mem.pl test.bed.gz 1:9551-10140 1
102848k maxresident
$ /usr/bin/time -f '%Mk maxresident' perl htsTabix_mem.pl test.bed.gz 1:9551-10140 10
108128k maxresident
$ /usr/bin/time -f '%Mk maxresident' perl htsTabix_mem.pl test.bed.gz 1:9551-10140 100
160880k maxresident
$ /usr/bin/time -f '%Mk maxresident' perl htsTabix_mem.pl test.bed.gz 1:9551-10140 1000
688240k maxresident

Seems a very similar problem to Bio::DB::HTS::Faidx

This is pretty critical as we've discovered this in the middle of a pre-release test cycle