File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JInternalFrame is closed, but stay in the memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JInternalFrame is closed, but stay in the memory" Watch "JInternalFrame is closed, but stay in the memory" New topic

JInternalFrame is closed, but stay in the memory

Nagy Gabor

Joined: Oct 20, 2003
Posts: 1
I have problem with using of JInternalFrame.
I create a new internal frame, and close it."setClosed(true);dispose();"
The frame does not release the memory (after gc the allocated memory is the same)
Before close I removed all listeners, and closed all reference to other object. (I think so :-) )
Do You have any idees?
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

I tested this out and it looks like if you ever use JInternalFrame, one reference hangs around forever... I'm trying to trace where this reference is saved, but not having much luck. However, this shouldn't lead to a memory leak because if you launch two or three internal frames and close them all you won't have two or three references hanging around, only one.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Vinicius Souza
Ranch Hand

Joined: May 18, 2011
Posts: 70

I was with the same problem here and solved it using this code on the internalFrameClosed event:

Best regards.

Java is the best (I love C too) heehhh
bhim Nagarhalli

Joined: Feb 03, 2013
Posts: 1

try this code. :-)
Darryl Burke

Joined: May 03, 2008
Posts: 5115

bhim Nagarhalli wrote:

try this code. :-)

First of all, this thread is way past its 'best by' date. Additionally, your code cannot compile, and since a Container cannot be added to itself, would never remove anything even if the typo is ignored.

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link:
subject: JInternalFrame is closed, but stay in the memory
It's not a secret anymore!