-
Notifications
You must be signed in to change notification settings - Fork 1.1k
By-name params used only in a lazy field should be cleared to prevent leaks #1692
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
Labels
Comments
@DarkDimius Let's discuss how this can be best achieved. Looks not easy to me. |
This can be achived by having a pass before lazy vals that marks that |
Needed to make |
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 10, 2018
Private fields that are only used during lzyy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 10, 2018
Private fields that are only used during lzyy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 11, 2018
Private fields that are only used during lzyy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 11, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 11, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 12, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 30, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
May 1, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
May 1, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
May 9, 2018
Private fields that are only used during lazy val initialization can be assigned null once the lazy val is initialized. This is not just an optimization, but is needed for correctness to prevent memory leaks.
allanrenucci
added a commit
that referenced
this issue
May 9, 2018
Fix #1692: Null out fields after use in lazy initialization
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Noticed in #1691 — scalac, but not dotty (as pointed out by @smarter), compiles the following so the initializer for
byLazyValMsg
clearsbyNameMsg
. This is not just an optimization, but is needed for correctness to prevent memory leaks:Resulting code with Scalac (as decompiled with jad)—note
byName = null;
:Maybe but not to my knowledge; I've seen similar patterns often enough and Dragos described this in scala/scala#922 as:
I found that PR by searching JIRA https://issues.scala-lang.org/browse/SI-6092 (which is not about this "feature" missing altogether, just about a bug with it).
The text was updated successfully, but these errors were encountered: