<Swing Dev> [12] RFR JDK-8204963:javax.swing.border.TitledBorder has a memory leak

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Mon Aug 6 14:40:40 UTC 2018


Hi All,

Please review a memory leak issue in javax.swing.border.TitledBorder 
where it is seen that TitledBorder instances are never freed. This leak 
is an aftereffect of JDK-8152159.
This is because 
javax.swing.border.TitledBorder.installPropertyChangeListeners() creates 
an instance of an anonymous inner class that implicitly holds a 
reference to the containing TitledBorder class.
Proposed fix is to make it a named static class so that it does not hold 
reference and can be garbage collected.

Bug:https://bugs.openjdk.java.net/browse/JDK-8204963
webrev: http://cr.openjdk.java.net/~psadhukhan/8204963/webrev.0/

8152159 testcase also worked well.

Regards
Prasanta



More information about the swing-dev mailing list