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


Groups > comp.lang.java.help > #1901

Re: Remove JFrame from memory

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.help
Subject Re: Remove JFrame from memory
Date 2012-06-28 22:02 -0400
Organization The Wasteland
Message-ID <nospam-8C752E.22024228062012@news.aioe.org> (permalink)
References <84ceeec7-1304-4012-9255-62169dc8dc58@googlegroups.com> <jshrp5$kkh$1@dont-email.me>

Show all headers | View raw


In article <jshrp5$kkh$1@dont-email.me>,
 Knute Johnson <nospam@knutejohnson.com> wrote:

> On 6/28/2012 6: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. So the garbage 
> > collector never removes the object from memory - why?
>
> [...]
> 
> I don't know but it doesn't really matter.  Calling dispose() on it 
> will work fine in a real world program.

Jesper Johnsen: Knute raises a very practical point.

This Q&A profiles a pathological example that opens and disposes 
thousands of JFrame instances, revealing the slow accumulation of 
resources committed to the frame's graphics peer on the host side.

<http://stackoverflow.com/q/6309407/230513>

You can repeat the experiment like this:

$ java -Xms30M -Xmx30M -cp build/classes DialogClose &
$ jvisualvm &

It may help to know what motivates your concern. 

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

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


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