JDK-6482571 : Leak in MetalLookAndFeel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-10-16
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b22Fixed
Related Reports
Relates :  
Description
MetalLookAndFeel references the current MetalTheme via a static. This means if you've used Metal once, or a different AppContext used Metal, you'll keep the unneeded reference around.

Comments
EVALUATION Most likely these static variable were used to optimize access to the current theme. Instead of getting the currentTheme property from AppContext the code uses cached static value if AppContex is the same. This 'optimization' does not quite work. For one it introduces the leak reported in this bug. The other issue is the cached value might be wrong in case multiple threads from different AppContexts access MetalLookAndFeel simultaneously (it might happen in the applet case for example). I suggest to get rid of this caching and use AppContext every time.
06-08-2007

EVALUATION Odd, looks like MetalLookAndFeel does *something* about storing the current theme in the app context, but it *also* keeps the static.
04-06-2007

EVALUATION Needs to be fixed.
23-10-2006