Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
8241840: Memoryleak: Closed focused Stages are not collected with Monocle. #153
8241840: Memoryleak: Closed focused Stages are not collected with Monocle. #153
Changes from 3 commits
26660df
7f535de
991d3ff
20865db
5992550
d5cb902
3f618c1
b4c0651
4cfe3ca
a7c9d83
2971a11
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my Window10 machine, with this change,
Window.focusedWindow
remainsnull
even after the first window (I have not verified with multiple windows though) is shown onto the screen and is focused. And It continues to remainnull
until some mouse or key action is performed on the window.I am not sure if this causes any side effects. It looks like the
Window.focusedWindow
is mostly(only) used for Monocle.Can you please confirm the behavior that
Window.focusedWindow
remainnull
and check for any side effects.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned - I don't have a good setup to test this code on Windows.
But I've checked where focusedWindow/getFocusedWindow is used, and I can verify your assumption. I've searched through the whole project and the variable is only used in the MonocleCode.
The fact that focusedWindow get's sometimes set is probably the cause of the irregular happening memoryleak on Window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In reading the comments, I thought you were going to revert the changes to
Window.java
? Or did I misinterpret what you said earlier?I can confirm that
focusedWindow
is no longer correctly set to the focused window when that Window is first shown (I tried this on Windows). This is true for apps with multiple windows as well as single Stage apps. I can also confirm thatfocusedWindow
isn't used on any platform other than Monocle. Even so, since this change isn't needed it seems best to revert it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation for this change was, that I've seen a similar bug on native-windows without monocle.
In this case a leak happened related to the focusedWindow variable.
Sadly I don't have a test for this bug, because it is undeterministic.
For that reason, I thought it would make sense to keep this change, because I think it fixes it.
If I remember correctly, it was related to Stages which were focused but closed at the same time, which only weren't collected because of the focusedWindow variable.
Because the variable also isn't used on NativeWindows it doesn't seem to do much harm.
I've now removed it, but it might be considered to be readded.