JInternalFrame & Garbage Collection
800987Sep 30 2010 — edited Oct 1 2010I 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