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

gather-take leaks memory #5144

Closed
bbkr opened this issue Dec 27, 2022 · 3 comments
Closed

gather-take leaks memory #5144

bbkr opened this issue Dec 27, 2022 · 3 comments

Comments

@bbkr
Copy link

bbkr commented Dec 27, 2022

raku -e 'use Telemetry; my @s = lazy gather loop { take rand x 1024 }; for @s { say T{"max-rss"} }'

It looks like taken values are not disposed properly - the bigger the values the bigger memory leak.

# raku -v
Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.
@bbkr
Copy link
Author

bbkr commented Dec 27, 2022

Same for 2022.12, but the leak seems to be slower here.

@ab5tract
Copy link
Collaborator

ab5tract commented May 16, 2024

Memory usage is stable when using $s := instead of @s =:

> r 'use Telemetry; my $s := lazy gather loop { take rand x 1024 }; for $s { say T{"max-rss"} }'
146
...
146
> ./rakudo-m -v
Welcome to Rakudo™ v2024.04-92-g24057e69c.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2024.04-6-g84121f0de.

Not sure whether that classifies this into DIHWIDT territory or not...

@bbkr
Copy link
Author

bbkr commented May 16, 2024

Uh, I kind of feel stupid now...

$ raku -e 'my @s = lazy gather loop { take rand }; say @s[3]; say @s[4]; say @s[3];'
0.5002519799798362
0.9103084169123906
0.5002519799798362 # this is materialized

I have no idea why I thought @s will keep lazy Seq itself without binding. So yes, DIHWIDT :)

@bbkr bbkr closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants