Subject: | memory leak in List::Util::first |
under perl 5.8.6 gcc 3.4.3 both on linux and solaris.
Memory leak in List::Util::first : the memory usage of the process keeps increasing (but should be constant) until "out of memory"
I've managed to reduce the bug to the following script:
#! /usr/bin/env perl
use warnings;
use strict;
use List::Util;
my $nb_tests = 70000;
my @tab = (0..1000);
foreach my $si (0..$nb_tests-1) {
print STDERR "$si\r";
my @scores = (1..$nb_tests);
my $rank = List::Util::first { $scores[$_] < 2 } @tab;
}
Execute the script and watch the memory usage...
It seems that the @scores array is not garbage-collected.
Hope that may help improving this very useful neat piece of software.
Thanks
Karl Forner
#! /usr/bin/env perl
use warnings;
use strict;
use List::Util;
my $nb_tests = 70000;
my @tab = (0..1000);
foreach my $si (0..$nb_tests-1) {
print STDERR "$si\r";
my @scores = (1..$nb_tests);
my $rank = List::Util::first { $scores[$_] < 2 } @tab;
}