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

Rapidly growing RAM usage when interpolating codeblock in regexes #5632

Closed
p6rt opened this issue Sep 1, 2016 · 5 comments
Closed

Rapidly growing RAM usage when interpolating codeblock in regexes #5632

p6rt opened this issue Sep 1, 2016 · 5 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Sep 1, 2016

Migrated from rt.perl.org#129161 (status was 'resolved')

Searchable as RT129161$

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 1, 2016

From @zoffixznet

This program starts off at 140MB and rapidly grows to 1.7GB of used RAM by the 1000th iteration​:

perl6 -e 'for ^1000 { say "Iter $_"; "foo".subst​: :g, /<{"abc".comb.join("\\s")}>/, "" }'

If the interpolated string is changed to just "a\\sb\\sc", the issue goes away.

And if we store the computation in a variable first and then use the variable in a regex, the leak seems to be much less severe (but still present; leaks up to about 500MB by the 1000th iteration)​:

perl6 -e 'for ^100000 { say "Iter $_"; my $x = "abc".comb.join("\\s"); "foo".subst​: :g, /<$x>/, "" }'

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 1, 2016

From @zoffixznet

Present today's HEAD on rakudo-moar a45202

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 14, 2016

From @jnthn

On Thu Sep 01 09​:28​:21 2016, cpan@​zoffix.com wrote​:

This program starts off at 140MB and rapidly grows to 1.7GB of used
RAM by the 1000th iteration​:

perl6 -e 'for ^1000 { say "Iter $_"; "foo".subst​: :g,
/<{"abc".comb.join("\\s")}>/, "" }'

If the interpolated string is changed to just "a\\sb\\sc", the issue
goes away.

And if we store the computation in a variable first and then use the
variable in a regex, the leak seems to be much less severe (but still
present; leaks up to about 500MB by the 1000th iteration)​:

perl6 -e 'for ^100000 { say "Iter $_"; my $x = "abc".comb.join("\\s");
"foo".subst​: :g, /<$x>/, "" }'

Boiled down to an EVAL-related leak, which was in turn due to a serialization context management bug in MoarVM. Fixed now; it grows to a point then settles.

/jnthn

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 14, 2016

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

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 14, 2016

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this Sep 14, 2016
@p6rt p6rt added the perf label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant