JDK-6824600 : OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2009-04-01
  • Updated: 2011-01-19
  • Resolved: 2009-09-16
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.
Other Other JDK 6 JDK 7
5.0u24-revFixed 5.0u25Fixed 6u21-revFixed 7 b72Fixed
Description
In the attahched program which provides selecter of L&F, wehn use selects "Windows" several times,
OOM occurs.

CONFIGURATIONs:
OS :WindowsXP
JDK:5.0u18/6.0u13
MEM : 2GB
CPU : Xeon 2.7G *2

REPRODUCTION:
1. Compile the attached LaFChange.java with -Xlint:deprecation.
2. Invoke "java -Xmx16m LaFChange"
You will see L&F selector windows.
3. Select "Windows" several times (5-10 times)
4. OOM occurs

NOTE:
OOM does not occur in "Metal" and "Motif". Only "Windows" cause the OOM

Comments
EVALUATION It is impossible to have two different toolkits in one JVM, therefore I removed all toolkit fields when possible. I also changed com.sun.java.swing.plaf.windows.DesktopProperty#invalidate: it's not necessary to remove WeakPCL from the Toolkit.
14-08-2009

EVALUATION OOM is throwing because after every change of LAF the previous LookAndFeel cannot be colected by GC. It happens because a strong reference to LAF remains. The fix is to remove unnecessary strong references from the com.sun.java.swing.plaf.windows.DesktopProperty#getValueFromDesktop method.
22-05-2009

WORK AROUND JLE created To specify -Dswing.noxp=true *** (#1 of 1): [ UNSAVED ] ###@###.###
01-04-2009

EVALUATION Assigned to our memory leak expert
01-04-2009