Skip to main content

Skins and Memory Leaks...

2 replies [Last post]
tdanecito
Offline
Joined: 2005-10-10

Hi All,

I ran into an interesting issue with Skins last weekend. Seems when I use the Nimbus skin and the Substance Skin with JinternalFrame and close the JInternalFrame it closes and the JInternalFrame object is GC for Substance Skin but not when using Nimbus.
I did do the following:
1. DISPOSE_ON_CLOSE was used for the JInternalFrame
2. I removed listeners for the JInternalFrame when the window was closing
3. Made sure there were no hard references to the JInternalFrame.

I did notice what I had left as references in VisualVM was SynthInternalFrameTitlePane, SynthInternalFrameUI and SynthDesktopIconUI. Perhaps Substance did something to make sure whatever Nimbus was doing was removed or nulled?

Anyone have any ideas what to do?

Regards,
-Tony

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tdanecito
Offline
Joined: 2005-10-10

Sorry forgot to mention I am using 1.6.0_21 (also happens with 6u20) and Substance 6.0 on Windows 7 32-bit.

Regards,
-Tony

tdanecito
Offline
Joined: 2005-10-10

Okay. I created a very simple example for others and sure enough the problem is repeatable.
I look forward to someone who can figure out why JInternalFrames are not being GC'd.

Regards,
Tony

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;

public class TestMDI {

/**
* @param args
*/
public static void main(String[] args) {

Runnable worker = new Runnable() {
public void run() {
JFrame frm = new JFrame();

JDesktopPane jdp = new JDesktopPane();

frm.add(jdp);

JInternalFrame jifrm1 = new JInternalFrame();
jifrm1.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jifrm1.setSize(100,100);
jifrm1.setClosable(true);

jdp.add(jifrm1);
jifrm1.setVisible(true);
jifrm1 = null;

JInternalFrame jifrm2 = new JInternalFrame();
jifrm2.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jifrm2.setSize(100,100);
jifrm2.setClosable(true);
jdp.add(jifrm2);
jifrm2.setVisible(true);
jifrm2 = null;

frm.setSize(400, 400);
frm.setVisible(true);
};
};
try {
SwingUtilities.invokeLater(worker); // required for
} catch (Exception ex) {

}

}

}

Message was edited by: tdanecito