Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15717
| From | markspace <-@.> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Closing/Despose of JFrame |
| Date | 2012-06-28 07:22 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <jshpac$3v7$1@dont-email.me> (permalink) |
| References | <5752befc-aca1-46f9-81d9-f3992bf756e7@googlegroups.com> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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