Skip Menu |
Report information
Id: 131829
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Weird memory leakage of sequences and other things ( (1…∞).grep(* < 0)[^10] )
Download (untitled) / with headers
text/plain 484b
Code: say (1…∞).grep(* < 0)[^10] Given that all of the values are thrown away by grep, I expect the memory usage to be constant (even though the code will never finish). However, it seems that there's a leak somewhere. There's a lot to this, so please see IRC log: https://irclog.perlgeek.de/perl6-dev/2017-08-02#i_14956475 For example, gather-take seems to be leaking as well, and in some cases it doesn't leak if you remove map, or if you use a range instead of a sequence…
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.1k
On Wed, 02 Aug 2017 03:59:53 -0700, alex.jakimenko@gmail.com wrote: Show quoted text
> Code: > say (1…∞).grep(* < 0)[^10] > > > Given that all of the values are thrown away by grep, I expect the > memory usage to be constant (even though the code will never finish). > However, it seems that there's a leak somewhere. > > There's a lot to this, so please see IRC log: > https://irclog.perlgeek.de/perl6-dev/2017-08-02#i_14956475 > For example, gather-take seems to be leaking as well, and in some > cases it doesn't leak if you remove map, or if you use a range instead > of a sequence…
Found another example without any maps or WhateverCodes that's leaking on 2017.07-87-g6d3ba60 and I'm fairly sure I tried that code a while back (to see if `$a = Seq; for @$a` vs `$a := Seq; for $a` was caching/non-caching) and back then memory didn't grow on this code. my $a := 1…∞; for $a {} And this is the same gather/take issue as binding to an infinite Seq made out of an Iterator instead of gather/take does not leak anything: my $a := Seq.new: class :: does Iterator { method is-lazy (-->True) {}; method pull-one { 42 } }.new; for $a {}


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org