<Swing Dev> RFR 6542439:Significant memory leak in BasicComboBoxUI and MetalComboBoxButton

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Thu Aug 20 13:54:55 UTC 2020


Hi All,

Please review a fix for an memory leak issue whereby the BasicComboBoxUI 
uses a CellRenderer pane to paint the renderer component
retrieved via getListCellRenderer from the JList instance. 
CellRendererPane paint the component but it never removes it from its 
component hierarchy.
JCombobox can produce dynamic renderer component instances in 
getListCellRenderer method. Each one of these instances
will linger in memory because it remains in the component hierarchy of 
the CellRendererPane resulting in memory leak.

This is solved for JList in JDK-5044798 
<https://bugs.openjdk.java.net/browse/JDK-5044798>.

The fix is now extended for BasicComboBoxUI where removeAll() of 
components is done after all painting is done.

The JDK-5044798 <https://bugs.openjdk.java.net/browse/JDK-5044798> 
regression testcase is used for JComboBox with all L&Fs and other 
*ComboBoxUIs are fixed similarly.

Bug: https://bugs.openjdk.java.net/browse/JDK-6542439

webrev: http://cr.openjdk.java.net/~psadhukhan/6542439/webrev.0/

Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20200820/110bbcde/attachment.htm>


More information about the swing-dev mailing list