Re: Unable to free memory used by DisplayImpl

Hi Lezlie,

If you are trying to get rid of a display completely, removing it from the tabbed pane won't be enough. You will need to make sure that every object that has a reference to your display sets it to null. If one object is holding onto your display it will not be eligible for garbage collection.

The other suggestion I have which what we use is to have one display only and remove references when they need to be deleted and toggle renderer visibility when something needs to be hidden.

Hope this helps,
Luke

Bill Hibbard wrote:

Hi Lezlie,

I am sorry that these memory problems persist. We have gone
over VisAD very carefully to make sure that DisplayImpl.destroy()
gets rid of all references it should, but it seems we still have
memory problems.

One approach is to re-use DisplayImpls, as described at:

 
http://my.unidata.ucar.edu/cgi-bin/getfile?file=/content/support/help/MailArchives/visad-list/msg02549.html

Perhaps someone else has more recent experience with this
problem, and will comment.

Good luck,
Bill

On Wed, 25 May 2005, Lezlie Fort wrote:

Hello,

I am experiencing a problem that I hope someone will be able to address:

I have written an application that can generate multiple 3D or 2D graphs
in separate displays placed in separate tabs of a JTabbedPane.  This
method of display has seemed to work well, for the most part.  The
problem I am having, however, is that on occasion I may display 3D
graphs with large amounts of data.  For example, I have one graph with
approximately 34,500 points.  I ran a test case wherein this particular
graph was displayed on 4 different tabs simultaneously.  No problem.
However, when I try to perform subsequent memory-intensive operations
(eg:  generating an irregular surface graph), I find that I run out of
memory and the application dies silently.  This is not unexpected, since
obviously the more graphs I display, the less memory I have available.
So my remedy is to provide a way for users to delete any desired
displayed graph from the JTabbedPane.  When I do this, I remove all of
the items from the panel in the JTabbedPane (including the display), and
then set the panel to null.  Additionally, I have a way to execute an
explicit System.gc() command from the GUI (more for test purposes than
anything else).  When I do this, however, I see absolutely no reduction
in the amount of used memory (I have a performance monitor running
simultaneously, so that I can observe memory usage as I execute the
application).   Is there a way that I can explicitly free the memory
that is being used by a display when it is no longer needed? (I have
attempted display.destroy(), but it seems to have no effect).  What am I
missing?

Thanks,
lzf




  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: