Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JInternalFrame & Garbage Collection

800987Sep 30 2010 — edited Oct 1 2010
I am looking for a work-around for the long standing bug [4759312|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4759312]. In this bug, the JDesktopFrame maintains a reference to the last JInternalFrame to be closed, preventing it from being garbage collected. The recommendation that I have seen elsewhere is to remove everything from the JInternalFrame's contentPane so that those component's can be collected even if the JInternalFrame is not. However, that approach is not working for me. Here is an example that demonstrates the problem:

Edited: Removed example as it contained some typos, see below

If you create a new window, and then close it, the SimplePanel it stays in memory. My debugger shows that it's only references are it's button and layout manager. However, the button is referenced from JInternalFrame.lastFocusOwner, which is probably what is preventing it from being collected.

How can I clear this reference? Is there another workaround to this bug that works better?

Sorry, if this has been addressed before - the search on the old forums.sun.com is taking several minutes to respond to a query.

Edited by: 797984 on Sep 30, 2010 11:49 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 29 2010
Added on Sep 30 2010
6 comments
758 views