United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6824600 OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
JDK-6824600 : OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)

Details
Type:
Bug
Submit Date:
2009-04-01
Status:
Resolved
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2009-09-16
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u13
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

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
WORK AROUND

JLE created

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

Assigned to our memory leak expert
                                     
2009-04-01
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.
                                     
2009-05-22
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.
                                     
2009-08-14



Hardware and Software, Engineered to Work Together