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

Parser Combinators and DynamicVariable combine to leak memory #9010

Closed
scabug opened this issue Nov 27, 2014 · 4 comments
Closed

Parser Combinators and DynamicVariable combine to leak memory #9010

scabug opened this issue Nov 27, 2014 · 4 comments
Labels

Comments

@scabug
Copy link

@scabug scabug commented Nov 27, 2014

I ran into a problem recently where, if I created and used a lot of Parser objects in a single thread, my application would OOM. Looking at the heap dump, I saw that that thread had thousands of inheritable thread locals, each of which had a DynamicVariable that held a reference to a Parser$Failure object, keeping my parser alive.

This DynamicVariable was introduced by the fix in #4929, specifically scala/scala@dce6b34

I'm not familiar with DynamicVariable so I don't know if the behavior I'm seeing is a bug in DynamicVariable or a bug in how the parser libraries use DynamicVariable - all I know is that, in this instance, they're combining to keep objects alive in a way that the garbage collector apparently can't see through.

I'm attaching a file to reproduce it; compile the file, then do

   JAVA_OPTS="-verbose:gc -Xmx256m -Xms64m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError" scala ParserLoop

and you'll have a heap dump in short order.

@scabug
Copy link
Author

@scabug scabug commented Nov 27, 2014

Imported From: https://issues.scala-lang.org/browse/SI-9010?orig=1
Reporter: David Carlton (davidcarltonsumo)
Affected Versions: 2.11.4
See #4929
Attachments:

@scabug
Copy link
Author

@scabug scabug commented Jul 17, 2015

@SethTisue said:
The parser combinators library is now community-maintained. Issues with it are now tracked at scala/scala-parser-combinators#61 instead of here in the Scala JIRA.

Interested community members: if you consider this issue significant, feel free to open a new issue for it on GitHub, with links in both directions.

@scabug scabug closed this Jul 17, 2015
@scabug
Copy link
Author

@scabug scabug commented Jul 18, 2015

@SethTisue said (edited on Jul 18, 2015 12:36:45 AM UTC):
there is a PR for this, needing review, at scala/scala-parser-combinators#59

@Philippus
Copy link
Member

@Philippus Philippus commented Jun 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.