Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Memory leak in ActionUtils - permanent connection between Actions and Buttons. #939
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.