Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #1899
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Remove JFrame from memory |
| Date | 2012-06-28 11:57 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <jshusm$9gp$1@dont-email.me> (permalink) |
| References | <84ceeec7-1304-4012-9255-62169dc8dc58@googlegroups.com> |
On 6/28/2012 9:48 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. I take it you found this by looking at memory usage in the Task Manager. For programs that do a lot of custom memory management, a category which Java falls into, what Task Manager reports is fairly useless. For various reasons, the "memory" that Java uses can be divided into several classes: VM - the amount of virtual memory that the OS has given to Java committed - the amount of virtual memory that is backable by physical memory allocated - the amount of virtual memory that is actually used by some objects in memory. The number you see in the task manager is most closely correlated to the first metric (more specifically, it's the amount of memory which isn't accessible to any other processes). To see the other values, you need to use Java's internal memory management APIs. IIRC, Java does what amounts to lazy initialization of the AWT, which you probably can't uninitialize, so some of the memory usage you see may be related to the AWT initialization. In short: you have numbers which are useless and say pretty much nothing. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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