Subject: | memory leak in subsets iteration? |
Thanks for this module.
Perhaps I misunderstood the docs, but I expected to be able to use
iterator function without ongoing memory growth.
Using the below sample script, the memory on my system is exhausted in
less a minute.
Is there a memory leak in the software or am I doing something wrong or
unexpected?
####
$|++;
use strict;
use Algorithm::Combinatorics qw( subsets);
my $balls = [ (1)x42,
(2)x152,
(4)x48,
(8)x144,
(16)x92,
(24)x55,
(32)x69 ];
my $iter = subsets($balls);
my %score_distribution;
my $times_so_far = 0;
while (my $r = $iter->next) {
print "loop so far: $times_so_far. Num in subset".scalar @$r." \n" if
(($times_so_far++ % 1000) == 0);
}