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


Groups > comp.lang.java.programmer > #15730

Re: Closing/Despose of JFrame

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Closing/Despose of JFrame
Date 2012-06-28 12:46 -0700
Organization http://groups.google.com
Message-ID <a6d7f54f-a8f9-4a7c-b656-403778d3136f@googlegroups.com> (permalink)
References <5752befc-aca1-46f9-81d9-f3992bf756e7@googlegroups.com> <JFrame-dispose-memory-20120628165746@ram.dialup.fu-berlin.de> <gc-20120628210556@ram.dialup.fu-berlin.de>

Show all headers | View raw


Stefan Ram wrote:
> Stefan Ram writes:
> >Jesper Johnsen writes:
> >>JFrame frame = new JFrame("Test");
> >public class Main implements java.lang.Runnable
> 
> public class Main implements java.lang.Runnable
> { public void run()
>   { for( ;; )
>     { java.lang.System.out.println( java.lang.Runtime.getRuntime().freeMemory() + " Bytes free." );
>       javax.swing.JFrame frame  = new javax.swing.JFrame();
>       frame.pack(); frame.setVisible( true ); frame.dispose(); frame = null; }}
> 
>   public static void main( final java.lang.String[] args ) throws java.lang.Throwable
>   { javax.swing.SwingUtilities.invokeAndWait( new Main() ); }}
> 
>   The above program shows declining amounts of free memory for
>   some time. Then, a gc seems to be triggered, which reclaims
>   a part of the memory. After several such gcs, there is less
>   and less memory reclaimed and one feels that soon an
>   unrecoverable out-of-memory error will happen. But then a
>   real deep major gc seems to be triggered that seems to
>   reclaim all or nearly all of the memory! (I stopped it then,
>   maybe someone wants to have this running overnight?)

Also there are answers to other incarnations of this multipost 
that go into how this all works.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Closing/Despose of JFrame Jesper Johnsen <jsjohnsen.dk@gmail.com> - 2012-06-28 06:38 -0700
  Re: Closing/Despose of JFrame markspace <-@.> - 2012-06-28 07:22 -0700
    Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-28 09:47 -0700
      Re: Closing/Despose of JFrame Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-28 23:31 +0000
        Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-28 17:42 -0700
      Re: Closing/Despose of JFrame Gene Wirchenko <genew@ocis.net> - 2012-06-28 19:55 -0700
        Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-29 10:19 -0700
          Re: Closing/Despose of JFrame Gene Wirchenko <genew@ocis.net> - 2012-06-29 13:24 -0700
            Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-29 13:36 -0700
      Re: Closing/Despose of JFrame Roedy Green <see_website@mindprod.com.invalid> - 2012-06-29 05:31 -0700
  Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-28 12:46 -0700
  Re: Closing/Despose of JFrame "John B. Matthews" <nospam@nospam.invalid> - 2012-06-28 22:32 -0400

csiph-web