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

Fix PhantomReference approach for TempFileCreator. #8614

Merged
merged 1 commit into from Sep 18, 2018

Conversation

Projects
None yet
3 participants
@alexandrtarasyuk
Contributor

alexandrtarasyuk commented Sep 18, 2018

Pull Request Checklist

Helpful things

Fixes

Should fix problem with TempFile objects not being released in memory (including proper deletion of underlining file).

Purpose

Remove tempFile from closure (to avoid strong reference to tempFile object preventing GC from triggering finalizeReferent of phantom reference).
As a result finalizeReferent method with deletePath is proper called when GC collects TempFile after usage.

Background Context

This issue was found as a result of memory leak investigation (all TempFile objects created are held in memory while play application is alive).

References

N/A

Remove tempFile from closure (to avoid strong reference to tempfile o…
…bject preventing GC from triggering finalizeReferent of phantom reference)
@marcospereira

LGTM. Good and subtle fix. :-)

Thank you, @alexandrtarasyuk. Let's just wait for a green build.

@mkurz mkurz merged commit 36eb967 into playframework:master Sep 18, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
typesafe-cla-validator All users have signed the CLA
Details

marcospereira added a commit that referenced this pull request Sep 18, 2018

Remove tempFile from closure (to avoid strong reference to tempfile o…
…bject preventing GC from triggering finalizeReferent of phantom reference) (#8614)
@marcospereira

This comment has been minimized.

Member

marcospereira commented Sep 18, 2018

Backport to 2.6.x: f9c05f6

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