great -- that's in now for 11.5.48.

Charles(Qian) Xie wrote:

> Hi Bob:
>
> I found that destroy() cannot clear the memory leak problem in the 
> following scenario:
>
> If there are multiple Jmol windows in a page and some of them are not 
> visible until the
> page is scrolled, the scripts sent to them will be pending. Now, if 
> the user leaves the
> page without scrolling down to the end and make QueueThread finish 
> their jobs, the
> threads will be hanging around and cause the Jmol instances to be 
> unable to clean
> themselves up even if destroy() is called for each instance.
>
> I added the following code to fix the problem:
>
> In Viewer:
>
>  public void setModeMouse(int modeMouse) {
>    //call before setting viewer=null
>    mouseManager.setModeMouse(modeMouse);
>    if (modeMouse == JmolConstants.MOUSE_NONE) {
>      //applet is being destroyed
>      clearScriptQueue();
>      haltScriptExecution();
>      transformManager.setSpinOn(false);
>      scriptManager.startCommandWatcher(false);
> *      scriptManager.interruptQueueThreads();*
>      g3d.destroy();
>    }
>  }
>
> In ScriptManager:
>
> *  void interruptQueueThreads() {*
> *    for (int i = 0; i < queueThreads.length; i++) {*
> *      if (queueThreads[i] != null)*
> *        queueThreads[i].interrupt();*
> *    }*
> *  }*
>
> And indeed, the problem is fixed and this loop hole of memory leak is 
> closed.
>
> Now, would it make sense if I sign up as a Jmol developer? I will 
> commit things
> only after discussing with you like the above.

Absolutely!

>
> Again, thanks for naming the threads, without which I cannot find this 
> mysterious
> memory leak due to the waiting queue threads.
>
> Charles Xie
> Tel: (978) 405-3226
> Fax: (978) 405-2076
>


-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get. 

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to