Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1895

Remove JFrame from memory

From Jesper Johnsen <jsjohnsen.dk@gmail.com>
Newsgroups comp.lang.java.help
Subject Remove JFrame from memory
Date 2012-06-28 06:48 -0700
Organization http://groups.google.com
Message-ID <84ceeec7-1304-4012-9255-62169dc8dc58@googlegroups.com> (permalink)

Show all headers | View raw


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 | NextNext in thread | Find similar | Unroll thread


Thread

Remove JFrame from memory Jesper Johnsen <jsjohnsen.dk@gmail.com> - 2012-06-28 06:48 -0700
  Re: Remove JFrame from memory Knute Johnson <nospam@knutejohnson.com> - 2012-06-28 08:04 -0700
    Re: Remove JFrame from memory "John B. Matthews" <nospam@nospam.invalid> - 2012-06-28 22:02 -0400
  Re: Remove JFrame from memory Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-28 11:26 -0400
    Re: Remove JFrame from memory Jesper Johnsen <jsjohnsen.dk@gmail.com> - 2012-06-29 00:58 -0700
      Re: Remove JFrame from memory Lew <lewbloch@gmail.com> - 2012-06-29 13:39 -0700
  Re: Remove JFrame from memory Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-06-28 11:57 -0400
    Re: Remove JFrame from memory Jesper Johnsen <jsjohnsen.dk@gmail.com> - 2012-06-29 01:00 -0700
      Re: Remove JFrame from memory Jesper Johnsen <jsjohnsen.dk@gmail.com> - 2012-06-29 01:03 -0700
        Re: Remove JFrame from memory Lew <lewbloch@gmail.com> - 2012-06-29 13:41 -0700
  Re: Remove JFrame from memory Lew <lewbloch@gmail.com> - 2012-06-28 10:23 -0700
  Re: Remove JFrame from memory Roedy Green <see_website@mindprod.com.invalid> - 2012-06-29 04:05 -0700
    Re: Remove JFrame from memory Lew <lewbloch@gmail.com> - 2012-06-29 13:40 -0700

csiph-web