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


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

Re: Closing/Despose of JFrame

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!204.52.135.9.MISMATCH!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Closing/Despose of JFrame
Date Thu, 28 Jun 2012 07:22:02 -0700
Organization A noiseless patient Spider
Lines 26
Message-ID <jshpac$3v7$1@dont-email.me> (permalink)
References <5752befc-aca1-46f9-81d9-f3992bf756e7@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 28 Jun 2012 14:22:04 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="Aj4gkJnboYPtscrbpd0V8g"; logging-data="4071"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197naNX90PgxCTHn2nMB6B08B63UoQE7L8="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
In-Reply-To <5752befc-aca1-46f9-81d9-f3992bf756e7@googlegroups.com>
Cancel-Lock sha1:UxWRAy1mEb6b2jzOmphjd7tCkkE=
Xref csiph.com comp.lang.java.programmer:15717

Show key headers only | View raw


On 6/28/2012 6:38 AM, Jesper Johnsen wrote:
> 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?


Why? Because the garbage collector never needs to remove the object. 
You're using 20mb out of maybe 100mb to 1000mb or more?  So the garbage 
collector looks at that and says "plenty o' room left!" and doesn't run.

It's weird if you're used to having explicit control over object 
destruction, but it works.  More importantly it's efficient.   Waiting, 
and then removing lots of objects at once, is actually best for 
throughput in the long run.

If you really need different behavior, check out Oracle's documentation 
on tuning the garbage collector.  You can choose what I believe is 
called an incremental garbage collector which will work more like what 
you are thinking.

<http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html>

Found via Google with search terms "java garbage collection tuning". 
Learn to STFW.

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