Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #1896
| From | jsjohnsen.dk@gmail.com |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Release memory used by JFrame |
| Date | 2012-06-28 06:44 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <0139c8ef-98e3-448d-a61f-12fb633422fc@googlegroups.com> (permalink) |
How do I remove an object lets say a JFrame from memory?
I know that the garbage collector handles this - but this simple example does not release itself...
java.exe uses 10mb in the first wait stage, this increases to 20mb when the JFrame is shown, but the memory usage never returns to the initial 10mb.
So the garbage collector never removes the object from memory - why?
package jframetest;
import javax.swing.JFrame;
public class JFrameTest {
public static void main(String[] args) {
try{
Thread.sleep(5000);
}catch(Exception Ex){}
JFrame frame = new JFrame("Test");
frame.setVisible(true);
try{
Thread.sleep(5000);
}catch(Exception Ex){}
frame.setVisible(false);
frame.dispose();
frame = null;
while(1==1){
try{
Thread.sleep(100);
}catch(Exception Ex){}
}
}
}
Back to comp.lang.java.help | Previous | Next | Find similar | Unroll thread
Release memory used by JFrame jsjohnsen.dk@gmail.com - 2012-06-28 06:44 -0700
csiph-web