Bob Hanson (the lead Jmol developer) has verified that replacing the .innerHTML within a div containing Jmol with plain html does destroy the applet and free up memory. Thus my suggestion should work. I haven't got any example clean code yet. I might get to it this evening, but no promises.
Jonathan On Sep 26, 12:45 pm, Jonathan <gu...@uwosh.edu> wrote: > I have my own answer to #3. I think that using document.write to > replace the applet with a picture when not in use should work. I > haven't investigated yet to see if it really saves memory. My > suggestion is to use the list of applets JmolApplet0, > JmolApplet1, ...JmolAppletn to keep only three to four applets active. > When the fifth is opened (#4) then #0 should be replaced with a > picture that has an onclick action that would reload the applet and > unload another. Doesn't sound like too bad a bit of javascript. > > Since I don't yet understand exactly how Jmol is used inside the > notebook, I don't think I can actually do the coding now. If I get a > chance later I will try it on a plain vanilla test page and pass along > the javascript that works for that. > > Jonathan > > On Sep 26, 7:24 am, Jonathan <gu...@uwosh.edu> wrote: > > > A few things related to the memory constraints: > > > 1) The available memory is limited by the set up of the JavaVM on the > > users computer. I believe 64 Mb is the default. If you need more you > > could supply instructions to the user on how to reset their JavaVM. > > There can also be issues with the browser's use of memory. > > > 2)Is Sage using the whole JmolApplet.jar or allowing Jmol to load > > pieces as needed starting with JmolApplet0.jar (may have the name > > wrong)? If these parts are in the Jmol applet directory, just > > specifying the path to the applet directory on the server should load > > the pieces only as needed. This will save memory and network > > bandwidth. > > > 3) Unloading the applet, when a plot isn't being used, might work. I > > am not sure it can be done without reloading the whole page. Once the > > applet is in the java cache you wouldn't have to move that across the > > network, so I don't think transit time would be a problem. I'll ask > > around on the Jmol lists. > > > Jonathan > > > On Sep 26, 2:38 am, Robert Bradshaw <rober...@math.washington.edu> > > wrote: > > > > On Sep 25, 2009, at 10:30 AM, Jason Grout wrote: > > > > > William Stein wrote: > > > > >> We could try changing how jmol is used in Sage as follows: when the > > > >> user isn't actively using the 3d image, it is replaced by a static > > > >> png. Then there would be at most 1 jmol applet per page. > > > > > That seems to be how mathematica does things. At least, when I have > > > > compiz turned on, I physically see the static figure be replaced > > > > (with a > > > > window swooping in) by a window that lets me rotate, and when I let > > > > go, > > > > the figure is redrawn as a static image. Sometimes this is really > > > > annoying, as I have to wait for the figure to be changed. > > > > > In our case, it sounds like we would have to wait for a round trip to > > > > the server every time we tried rotating things? (or maybe we'd wait a > > > > few seconds, and then replaced it?) > > > > > Is there any chance of making a "lite jmol" that was took much less > > > > than > > > > around 64/10=6.4M of memory? Surely there is a lot in jmol that we > > > > don't use or need at the moment. > > > > That'd be cool, but I doubt the 6.4M memory used is stuff we don't > > > use--the memory-intensive part is probably the rendering itself > > > (which we can't get by without). It'd be easy to see--how does the > > > memory footprint vary with the applet size? > > > > I think the idea of keeping a single applet, and shifting it around, > > > is a cool one, if it can be made snappy enough. Usually you only want > > > to manipulate the one you just made anyways. > > > > - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---