New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loop { 0, .1 ... 1000 }
leaks memory
#4592
Comments
From @TimToadyLeaks memory, probably due to the implicit function being called to produce |
From @FROGGSI did run this: $ valgrind --leak-check=full --show-leak-kinds=all /home/froggs/dev/nqp/install/bin/moar --execname="$0" --libpath="/home/froggs/dev/nqp/install/share/nqp/lib" --libpath="/home/froggs/dev/nqp/install/share/perl6/lib" --libpath="/home/froggs/dev/nqp/install/share/perl6/runtime" --full-cleanup /home/froggs/dev/nqp/install/share/perl6/runtime/perl6.moarvm -e 'my $x = 0; loop { 0, .1 ... 1000; exit if $x++ > 10; }' And the two biggets memory consumoptions are: ==8073== 5,750,160 bytes in 239,590 blocks are still reachable in loss record 2,318 of 2,319 Note that there are still reachable. All non-reachable areas are just a bunch of kilobytes in size. |
The RT System itself - Status changed from 'new' to 'open' |
From @smlsStill present on Rakudo version 2016.12-315-gdaf7e5185 built on MoarVM version 2016.12-113-gd1da1bac. Though to avoid a warning, you now have to write it like this: loop { sink (0, .1 ... 1000) } Also, while the memory leak that remains *after* each application of `...` may be the bigger worry, I think it shouldn't even accumulate memory *during* each iteration of `...`. Compare: 1) The following program uses 39.7 M of RAM shortly after starting, and still 39.7 M one minute later: .sink for 1..* 2) Whereas the following program uses about 52.4 M shortly after starting, and then keeps steadily accumulating RAM usage for as long as you run it (about 137.1 M after one minute): .sink for 1...* (Same problem for `1, 3 ... *` or `1, *+1 ... *` etc.) Brad Gilbert on Stack Overflow <http://stackoverflow.com/a/41670048/1160124> suggested that `LIST, CODE ... END` caches the whole sequence internally, in case CODE reference it. |
I'm pretty sure that this is now resolved. I had it running for like an hour or so, and maxrss stabilized on 148916 KiB. That's of course very high, but it's what any script will reach, the code in question is not leaking any extra memory. I tried both this: perl6 -e 'loop { say 0, .1 ... 1000; use Telemetry; say T<max-rss> }' And this: perl6 -e 'loop { 0, .1 ... 1000; use Telemetry; say T<max-rss> }' |
Migrated from rt.perl.org#126189 (status was 'open')
Searchable as RT126189$
The text was updated successfully, but these errors were encountered: