Bugs item #1524187, was opened at 2006-07-17 18:59
Message generated for change (Comment added) made by hansonr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379133&aid=1524187&group_id=23629

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Applet
Group: v11
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Tobias T (twobeers)
>Assigned to: Bob Hanson (hansonr)
Summary: memory hole: parent Component + Jmol don't get finalized

Initial Comment:
Hey guys,

thank you so much for providing Jmol. However, there is
one bug that really bugging me: Jmol has a memory hole,
and this means that by usign Jmol, my client program
has one too :-(

Apparently Jmol somehow stores a reference to itself
and the Component passed to JmolViewer.allocateViewer()
in some place that itself remains referenced forever:
Repeated invocations of allocateViewer() will
continuously increase the memory consumption, until a
java.lang.OutOfMemoryError occurs.

If an empty JPanel is passed as the component, the
memory usage increases by about 32 KBytes per
invocation. The JPanel itself is never finalized even
when the client program stores no references to it; the
JPanel itself is lightweight at less than 1 KByte.

I've attached a JUnit testcase that illustrates the
bug. The memory usage shouldn't increase from the start
to the end of the testcase, but it does increase by
tens of Megabytes (on my computer, using JDK 1.5.0_06
under win32, 1000 iterations yield 32,326,200 bytes lost). 

I've overriden the JPanel's finalize() method to
illustrate that the component never gets garbage
collected. Because the JPanel itself doesn't consume
this much memory, and because the Jmol Viewer is the
only thing that stiill has a reference to the panel, it
follows that the Jmol Viewer never gets garbage
collected either.



----------------------------------------------------------------------

>Comment By: Bob Hanson (hansonr)
Date: 2006-10-04 11:13

Message:
Logged In: YES 
user_id=1082841

This is fixed. It was an application-only problem; not an
issue with the applet. 

The mouseManager sets up a hoverWatcher thread and a few
mouse listeners, all of which had references to viewer. To
properly clear the viewer (for now), use:

viewer.setModeMouse(JmolConstants.MOUSE_NONE);
viewer = null;

not just

viewer = null;

Thank you very much for pointing us to this issue.

Bob Hanson


----------------------------------------------------------------------

Comment By: Bob Hanson (hansonr)
Date: 2006-10-01 01:50

Message:
Logged In: YES 
user_id=1082841

Nico, this one's for you. It's a failure to provide a
general public void destructor() method to Viewer that will
go turn off the three mouse listeners and the hover watcher. 
Do you know how to add that? (I don't.)
This would be something we would want to call from the
applet, as I see that viewer is not being finalized there,
either.


Bob


----------------------------------------------------------------------

Comment By: Nicolas (nicove)
Date: 2006-09-16 08:30

Message:
Logged In: YES 
user_id=1096197

Hi Tobias,

you said that you've attached a JUnit testcase, but I don't
find it. Could you send it to me?

Nico


----------------------------------------------------------------------

Comment By: Bob Hanson (hansonr)
Date: 2006-09-16 07:26

Message:
Logged In: YES 
user_id=1082841

Will close this soon if there's no report of it being
reproduced. Nico, is there an obvious fix to this? Can you
follow up?




----------------------------------------------------------------------

Comment By: Bob Hanson (hansonr)
Date: 2006-08-22 18:24

Message:
Logged In: YES 
user_id=1082841

we need help solving this one. Demo pages necessary 

----------------------------------------------------------------------

Comment By: Bob Hanson (hansonr)
Date: 2006-07-17 19:23

Message:
Logged In: YES 
user_id=1082841

Tobias, I'd love to get this fixed. What do you recommend?

I think I have also noticed that all instances of Jmol
remain "alive" until the browser application is closed, even
when the page is abandoned.
 
Do you have any references we could look at regarding proper
finalization upon page exit in a browser?

Bob Hanson


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379133&aid=1524187&group_id=23629

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to