MarvinSpace applet out of memory

User 133dd65c86

13-04-2013 19:27:22

Hi, I have a problem when trying to map electrostatic potential onto a larger molecule's surface in MSpaceApplet. I hope this is the right forum for this kind of problem. If so, here is the callstack:


java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at chemaxon.marvin.space.grid.WeightedValues.invoke(WeightedValues.java:240)
    at chemaxon.marvin.space.grid.WeightedValues.setWeightedValues(WeightedValues.java:288)
    at chemaxon.marvin.space.grid.WeightedValues.setAtomEntries(WeightedValues.java:127)
    at chemaxon.marvin.space.SurfaceColoring.doColoring(SurfaceColoring.java:315)
    at chemaxon.marvin.space.MolecularSurfaceComponent.coloringMolecularSurface(MolecularSurfaceComponent.java:1102)
    at chemaxon.marvin.space.MolecularSurfaceComponent.coloringMolecularSurface(MolecularSurfaceComponent.java:1208)
    at chemaxon.marvin.space.MolecularSurfaceComponent.setDrawProperty(MolecularSurfaceComponent.java:600)
    at chemaxon.marvin.space.GraphicCell.setDrawProperty(GraphicCell.java:718)
    at chemaxon.marvin.space.GraphicScene.setDrawProperty(GraphicScene.java:1171)
    at chemaxon.marvin.space.GraphicScene.setDrawProperty(GraphicScene.java:1188)
    at chemaxon.marvin.space.MSpaceEventHandler.coloringSurface(MSpaceEventHandler.java:1566)
    at chemaxon.marvin.space.MSpaceEventHandler.processNextEvent(MSpaceEventHandler.java:2175)
    at chemaxon.marvin.space.GraphicScene.display(GraphicScene.java:1914)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
    at javax.media.opengl.awt.GLJPanel$Updater.display(GLJPanel.java:655)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
    at jogamp.opengl.GLPbufferImpl$DisplayAction.run(GLPbufferImpl.java:300)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:425)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:364)
    at jogamp.opengl.GLPbufferImpl.invokeGL(GLPbufferImpl.java:286)
    at jogamp.opengl.GLPbufferImpl.display(GLPbufferImpl.java:149)
    at javax.media.opengl.awt.GLJPanel$PbufferBackend.doPaintComponentImpl(GLJPanel.java:1196)
    at javax.media.opengl.awt.GLJPanel$AbstractReadbackBackend.doPaintComponent(GLJPanel.java:942)
    at javax.media.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:356)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at chemaxon.marvin.space.GraphicScene.paint(GraphicScene.java:2101)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.access$1000(Unknown Source)
    at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at chemaxon.struc.MoleculeGraph.createBHtab(Unknown Source)
    at chemaxon.calculations.Charge.p(Unknown Source)
    at chemaxon.calculations.Charge.initArrays(Unknown Source)
    at chemaxon.calculations.Charge.initChargeCalc(Unknown Source)
    at chemaxon.calculations.Charge.calcCharges(Unknown Source)
    at chemaxon.marvin.calculations.ChargePlugin.run(Unknown Source)
    at chemaxon.marvin.space.AtomProperty$MoleculeAtomProperty.calcCharges(AtomProperty.java:101)
    at chemaxon.marvin.space.AtomProperty$MoleculeAtomProperty.getPartialAtomCharge(AtomProperty.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at chemaxon.marvin.space.grid.WeightedValues.invoke(WeightedValues.java:240)
    at chemaxon.marvin.space.grid.WeightedValues.setWeightedValues(WeightedValues.java:288)
    at chemaxon.marvin.space.grid.WeightedValues.setAtomEntries(WeightedValues.java:127)
    at chemaxon.marvin.space.SurfaceColoring.doColoring(SurfaceColoring.java:315)
    at chemaxon.marvin.space.MolecularSurfaceComponent.coloringMolecularSurface(MolecularSurfaceComponent.java:1102)
    at chemaxon.marvin.space.MolecularSurfaceComponent.coloringMolecularSurface(MolecularSurfaceComponent.java:1208)
    at chemaxon.marvin.space.MolecularSurfaceComponent.setDrawProperty(MolecularSurfaceComponent.java:600)
    at chemaxon.marvin.space.GraphicCell.setDrawProperty(GraphicCell.java:718)
    at chemaxon.marvin.space.GraphicScene.setDrawProperty(GraphicScene.java:1171)
    at chemaxon.marvin.space.GraphicScene.setDrawProperty(GraphicScene.java:1188)
    at chemaxon.marvin.space.MSpaceEventHandler.coloringSurface(MSpaceEventHandler.java:1566)
    at chemaxon.marvin.space.MSpaceEventHandler.processNextEvent(MSpaceEventHandler.java:2175)
    at chemaxon.marvin.space.GraphicScene.display(GraphicScene.java:1914)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
    at javax.media.opengl.awt.GLJPanel$Updater.display(GLJPanel.java:655)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
    at jogamp.opengl.GLPbufferImpl$DisplayAction.run(GLPbufferImpl.java:300)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:425)



It happens for seemingly no reason - for instance a molecule with 1044 atoms will get colored almost instantly, but a molecule with 1045 atoms will remain grey and immediately throw an out-of-memory error. Allocating more memory to java on the client machine doesn't seem to be making any difference.


Any help would be appreciated, thanks in advance.

ChemAxon 60613ab728

15-04-2013 06:26:46

Hi,


thanks very much for your error report.


Would it be possible to get copy of your input files? Please be aware that this is  public forum. If your structures are confidential you can use the [email protected] email address.


Which version of the software do you use?


Thanks,


Miklos

User 133dd65c86

15-04-2013 12:16:44

Thanks for the quick reply, I'm using Marvin version 5.12.0. I've attached two files, one is a small molecule (82 atoms and 83 bonds) which gets colored without a problem, the other one is a large molecule (1142 atoms and 1092 bonds) which instantly throws the out-of-memory error.

ChemAxon eb65a25631

16-04-2013 11:47:21

Hi,


By default, I cannot reproduce the issue with 5.12.


On the other hand, if I force to limit JVM heap size to 64Mb (-Xmx64m),


it starts to produce the same out of memory error.


(I tried creating van der Waals surface and change the coloring to 'Electrostatic Potential'.)


How did you allocate more memory for the JVM?


if you click on Help/About MarvinSpace, what is the maximum value displayed beside "Memory:"?


 


A.

User 133dd65c86

18-04-2013 14:32:14

Hello,


thank you for pointing this out, next to "Memory" Marvin reports a maximum of 247,5M.


I tried to allocate 2048M of memory for JVM in the operating system's control panel (Win7, Control Panel -> Programs -> Java -> runtime parameters -Xms2048m -Xmx2048m). However, the applet does not seem to be using this memory.


I'm sure the mistake is on my part, but I can't figure out what it is.

ChemAxon eb65a25631

19-04-2013 09:04:46

Hi,


I found, the memory limit set by the script (marvin.js) creating the applet.


If you have access to the server, I suggest to change that limit, or remove it from java_arguments altogether.


(It should be -Xmx... in marvin.js)


The other thing you can do, if you have 64bit OS, then try using a 64bit browser with a 64bit JRE.


During my tests, It occured to me this option has no effect on 64 bit Java.


Regards,


Andras

User 133dd65c86

21-04-2013 23:04:50

Hi,

thank you once again for your advice, but even after removing the argument or replacing it with a large number, the Memory reported by Marvin is still 247,5M. Same result in a 64-bit browser.


I am encouraged by the fact that the applet works in your tests and that this is not a bug within MarvinSpace, I hope that means that the issue is solvable for me as well.

User 133dd65c86

05-05-2013 18:53:39

If I may ask one last thing, how much memory did the applet have available in your tests? I have finally managed to assign nearly 1GB of memory to the applet, but it is still not enough to display the electrostatic potential of the larger molecule which you claimed to have no trouble with.


Thanks in advance for your answer.

ChemAxon eb65a25631

06-05-2013 08:30:26

In my tests, the out of memory exception started to occur around 64Mb memory limit.


So, even 256 Mb should be more than enough.


You may want to check the memory consumption of the java process, that the (1Gb or the limit) actually reached, when the exception occurs.


(One addition: the dendrotoxin molecule has to be fixed in MarvinSketch, otherwise the molecule won't be colored properly.)

User 133dd65c86

07-05-2013 01:04:59

The memory consumption of the java process varies, but it's always well over 300MB (probably getting much more than it needs because of my launch parameters).


I don't know how a molecule can be "fixed" in MarvinSpace, so I probably haven't fixed the dendrotoxin molecule. Can you please explain how I might do that?


Thank you.

ChemAxon eb65a25631

07-05-2013 08:25:58

To fix the molecule:


- Start a MarvinSketch


- Click Structure/Check Structure menu item


- Click 'Fix' on the Structure Checker dialog


- Save the fixed structure (to a different).


- Open the fixed structure in MarvinSpace


Regards,


Andras

User 133dd65c86

08-05-2013 13:52:25

Thank you, that did the trick! It's a bit confusing that the applet goes out of memory instead of throwing some kind of "invalid structure" error.


Thank you once again for the support and quick replies, you are great!

ChemAxon eb65a25631

09-05-2013 09:04:51

That's interesting:


we tried with multiple versions, and we did not get out of memory exception (unless we reduced the memory limit to a ridiculously low value).


We got uniformly grey colored surface witht he non-fixed molecule.


Regards,


Andras