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

Memory leak in ActionUtils - permanent connection between Actions and Buttons. #939

Closed
JonathanGiles opened this issue Mar 8, 2017 · 1 comment
Labels
bug
Milestone

Comments

@JonathanGiles
Copy link
Collaborator

@JonathanGiles JonathanGiles commented Mar 8, 2017

Original report by Alexander Scholübbers (Bitbucket: alexander_scholuebbers, GitHub: Unknown).


There is a memory leak in the ActionUtils class. When you bind an action to a button with the configure(...) method, then there is a ListChangeListener added to the styleClasses of the button in the bindStyle(...) method , that is never removed. The ListChangeListener uses a strong reference to the button and thus creates a permanent connection between the action and the button. The unconfigure(...) method of the ActionUtils class does not remove the listener.

In our application the actions are reused for many different views and stored permanently thus resulting in a big memory leak, because with this listChangeListener-Connection all the buttons including the parent view components including lots of viewed images are also stored permanently.

Could you please fix this memory issue?

One suggestion to fix this issue would be to use a weak reference to the button inside the listChangeListener.

Another suggestion would be to memorize the listChangeListener while configuring the button and removing it while unconfiguring the button.

@JonathanGiles

This comment has been minimized.

Copy link
Collaborator Author

@JonathanGiles JonathanGiles commented Mar 8, 2017

Original comment by Dirk Lemmermann (Bitbucket: dlemmermann, GitHub: dlemmermann).


You have already done the analysis. Why not provide a pull request with a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.