my poor memory managment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

my poor memory managment

keith
When I open a java3d window (NEWT+Ardor3d) it works perfectly. After I close and reopen it, I get an out of memory error.

The out of memory error occurs when I have a lot of models. Smaller amounts of meshes/nodes can be closed and restarted with no problems. I have closed and restarted simpler scenarios 5 or 6 times. It is the large and complex ones where I get this problem.

After I close it, then attempt to reopen it, I get:

com.jogamp.opengl.GLException: Caught RuntimeException: com.ardor3d.util.Ardor3dException: Error in opengl: out of memory on thread main
	at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)
	at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
	at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
	at jogamp.opengl.GLDrawableHelper.invoke(GLDrawableHelper.java:912)
	at jogamp.opengl.GLAutoDrawableBase.invoke(GLAutoDrawableBase.java:642)
	at com.ardor3d.framework.jogl.swt.JoglNewtSwtCanvas.draw(JoglNewtSwtCanvas.java:111)
	at com.ardor3d.framework.FrameHandler.updateFrame(FrameHandler.java:90)
	at com.neighborhoodinnovations.ThreeD.ardor3d.App3dBase.start(App3dBase.java:474)
	at com.neighborhoodinnovations.ui.actions.Action$172.preStep(Action.java:3087)
	at com.neighborhoodinnovations.ui.actions.Action.preStep(Action.java:6250)
	at com.neighborhoodinnovations.ui.App.invokeDetailMethod(App.java:9101)
	at com.neighborhoodinnovations.ui.App.doEntryStep(App.java:8822)
	at com.neighborhoodinnovations.ui.actions.ActionHandler.act(Action.java:6405)
	at com.neighborhoodinnovations.ui.actions.Action.act(Action.java:6147)
	at com.neighborhoodinnovations.ui.App$67.handleEvent(App.java:8053)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4410)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1103)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1088)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1130)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1126)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1547)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4910)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:364)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4791)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:359)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5102)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2552)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3814)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at com.neighborhoodinnovations.ui.App.main(App.java:13451)
Caused by: java.lang.RuntimeException: com.ardor3d.util.Ardor3dException: Error in opengl: out of memory
	at jogamp.opengl.GLRunnableTask.run(GLRunnableTask.java:67)
	at jogamp.opengl.GLDrawableHelper.execGLRunnables(GLDrawableHelper.java:770)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:676)
	at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
	... 33 more
Caused by: com.ardor3d.util.Ardor3dException: Error in opengl: out of memory
	at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(JoglRenderer.java:689)
	at com.ardor3d.renderer.jogl.JoglRenderer.flushFrame(JoglRenderer.java:237)
	at com.ardor3d.framework.jogl.JoglCanvasRenderer.draw(JoglCanvasRenderer.java:265)
	at com.ardor3d.framework.jogl.JoglDrawerRunnable.run(JoglDrawerRunnable.java:16)
	at jogamp.opengl.GLRunnableTask.run(GLRunnableTask.java:61)
	... 37 more
Caused by: com.jogamp.opengl.GLException: out of memory
	at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(JoglRenderer.java:686)
	... 41 more

Memory analysis (Eclipse MAT) at this point (from a generated heap dump) shows

314 instances of "com.ardor3d.scenegraph.Node", loaded by "sun.misc.Launcher$AppClassLoader @
 0x6c16b16e8" occupy 75,387,696 (52.34%) bytes. These instances are referenced from one instance of 
"java.lang.Object[]", loaded by "<system class loader>"

Keywords
java.lang.Object[]
com.ardor3d.scenegraph.Node
sun.misc.Launcher$AppClassLoader @ 0x6c16b16e8

On close of the window, I attempt to node.detatchAllChildren() for all the nodes I draw.


If you can suggest some other diagnostics or something else I can try to clear memory, I welcome your suggestions.


Reply | Threaded
Open this post in threaded view
|

Re: my poor memory managment

gouessej
Administrator
Hi

There are too many possible root causes, I cannot make any precise guess without having access to the source code.

Please pass useDebug to true when creating your JoglCanvasRenderer so that we get much more information. Then, JOGL will stop exactly at the faulty line. Maybe you don't have enough memory on your GPU to store a texture or a VBO. If it's an hardware limitation, there will be nothing that I can do.
Julien Gouesse | Personal blog | Website