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

Null out local variables that are no longer in use #6

Closed
retronym opened this issue Aug 5, 2015 · 3 comments
Closed

Null out local variables that are no longer in use #6

retronym opened this issue Aug 5, 2015 · 3 comments

Comments

@retronym
Copy link
Member

retronym commented Aug 5, 2015

scala/bug#9137

https://groups.google.com/forum/#!topic/scala-internals/zf36JWUoSAg

Here's a reference to a memory leak caused by inlining a Stream method: scala/scala#4284 (comment)

@lrytz lrytz added this to the 2.12.1+ milestone May 23, 2016
@lrytz
Copy link
Member

lrytz commented May 2, 2017

Aleksey Shipilёv explains in https://shipilev.net/jvm-anatomy-park/8-local-var-reachability/ that the JIT may collect objects early if it is only referenced by local variables that are no longer in use. But we cannot rely on that, as we'd need it to work from the beginning, before the code is JITed.

@adriaanm adriaanm modified the milestones: 2.12.x, 2.13.0-RC1 Sep 18, 2018
@lrytz
Copy link
Member

lrytz commented Oct 5, 2018

Done in scala/scala#7133

@lrytz lrytz closed this as completed Oct 5, 2018
@lrytz
Copy link
Member

lrytz commented Oct 5, 2018

Actually, not done in general, only done for local variables that were inlined into a method.

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

No branches or pull requests

3 participants