Skip to content
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

Weird memory leakage of sequences and other things ( (1…∞).grep(* < 0)[^10] ) #6420

Open
p6rt opened this issue Aug 2, 2017 · 4 comments
Labels
leak Rakudo Tickets to be moved to rakudo/rakudo/issues

Comments

@p6rt
Copy link

p6rt commented Aug 2, 2017

Migrated from rt.perl.org#131829 (status was 'open')

Searchable as RT131829$

@p6rt
Copy link
Author

p6rt commented Aug 2, 2017

From @AlexDaniel

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�

@p6rt
Copy link
Author

p6rt commented Aug 5, 2017

From @zoffixznet

On Wed, 02 Aug 2017 03​:59​:53 -0700, alex.jakimenko@​gmail.com wrote​:

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 {}

@p6rt
Copy link
Author

p6rt commented Aug 5, 2017

The RT System itself - Status changed from 'new' to 'open'

@AlexDaniel
Copy link
Member

Tried this:

perl6 -e 'start loop { sleep 2; use Telemetry; say T<max-rss> }; (1…∞).grep(* < 0)[^10]'

Still leaking memory!

@AlexDaniel AlexDaniel added Rakudo Tickets to be moved to rakudo/rakudo/issues leak labels Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leak Rakudo Tickets to be moved to rakudo/rakudo/issues
Projects
None yet
Development

No branches or pull requests

2 participants