Hi,
I've been working on a MoleculeViewer application, and it's necessary to load a lot of different (large; 3000+ nodes) models.
The problem is that I get a OoME exception after I load a particular large molecule for a third time:
System Setup:
Q6600 2.4Ghz
Vista X64 Ultimate
JDK1.6
Ati 2900 XT
4gb RAM
12gb Page File
java.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorException in thread "Thread-10" java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at com.jme.util.geom.BufferUtils.createFloatBuffer(Unknown Source)
at com.jme.util.geom.BufferUtils.createVector2Buffer(Unknown Source)
at com.jme.scene.shape.Box.setTextureData(Unknown Source)
at com.jme.scene.shape.Box.setData(Unknown Source)
at com.jme.scene.shape.Box.<init>(Unknown Source)
at View3D.Binding.<init>(Binding.java:33)
at moleculeviewer.MoleculeImport.importMol2H(MoleculeImport.java:92)
at View3D.RenderGamestate.importMolecule(RenderGamestate.java:226)
at moleculeviewer.GUI$11.run(GUI.java:555)
#
# An unexpected error has been detected by Java Runtime Environment:
#
# java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?
#
# Internal Error (allocation.cpp:120), pid=9292, tid=15828
# Error: ChunkPool::allocate
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode windows-x86)
# An error report file with more information is saved as:
# D:ProjectsMoleculeViewerhs_err_pid9292.log
#
java.lang.OutOfMemoryError
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 1
BUILD SUCCESSFUL (total time: 44 seconds)
To make things even more interesting, the Heap size is only around 90Mb at the point of the crash.
(with -Xms256m -Xmx1024m -XX:MaxDirectMemorySize=512m)
I also made sure that all the nodes are dereferenced, deParented, cleared from RenderStates, and the TextureManager is given the clear command before every molecule load.
Heap stack search gives me no remaining objects which could trigger the OoME. (Using Netbeans, HeapWalker)
The only thing I can think of is that all the atoms are locked() and that that GL data is not being released?
(Although I unlock() them in the destroy method, before the new Molecule is loaded)
To recap:
- Created Heap Dump
- Profiled Application
- Located Memory Leak
- Still OoME @ 90mb Heap Size Usage
Any help would be greatly appreciated!