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


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

Re: Closing/Despose of JFrame

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Closing/Despose of JFrame
Date 2012-06-28 22:32 -0400
Organization The Wasteland
Message-ID <nospam-E146D9.22325928062012@news.aioe.org> (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


In article <gc-20120628210556@ram.dialup.fu-berlin.de>,
 ram@zedat.fu-berlin.de (Stefan Ram) wrote:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
> >Jesper Johnsen <jsjohnsen.dk@gmail.com> 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?)

I cited a similar experiment here, using an artificially small heap to 
exaggerate the effect:

<news:nospam-8C752E.22024228062012@news.aioe.org>
<https://groups.google.com/d/msg/comp.lang.java.help/ylUG68cHsWQ/h1FMBzKirkwJ>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Back to comp.lang.java.programmer | Previous | NextPrevious 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