Memory leak in forsquarefree
trizen opened this issue · 2 comments
trizen commented
It seems that there are some memory leaks in forsquarefree
every time the function is called.
The issue can be reproduced with the code below, which starts using more and more RAM.
use ntheory qw(:all);
for (my $n = 1; ; $n += 1e6) {
forsquarefree {
# ...
} $n, $n+1e6;
}
This also seems to happen with the forfactored
loop.
Other loops, such as forprimes
or forcomposites
, do not have this issue.
danaj commented
forsquarefree and forfactored were missing a factor_range_destroy call. Added, with many thanks!
trizen commented
Thank you for the fix. Welcome back! :)