my poor memory managment

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

my poor memory managment

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(
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(
	at jogamp.opengl.GLDrawableHelper.invokeGL(
	at com.jogamp.newt.opengl.GLWindow.display(
	at jogamp.opengl.GLDrawableHelper.invoke(
	at jogamp.opengl.GLAutoDrawableBase.invoke(
	at com.ardor3d.framework.jogl.swt.JoglNewtSwtCanvas.draw(
	at com.ardor3d.framework.FrameHandler.updateFrame(
	at com.neighborhoodinnovations.ThreeD.ardor3d.App3dBase.start(
	at com.neighborhoodinnovations.ui.actions.Action$172.preStep(
	at com.neighborhoodinnovations.ui.actions.Action.preStep(
	at com.neighborhoodinnovations.ui.App.invokeDetailMethod(
	at com.neighborhoodinnovations.ui.App.doEntryStep(
	at com.neighborhoodinnovations.ui.actions.ActionHandler.act(
	at com.neighborhoodinnovations.ui.actions.Action.act(
	at com.neighborhoodinnovations.ui.App$67.handleEvent(
	at org.eclipse.swt.widgets.EventTable.sendEvent(
	at org.eclipse.swt.widgets.Display.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(
	at org.eclipse.swt.widgets.Widget.wmChar(
	at org.eclipse.swt.widgets.Control.WM_CHAR(
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(
	at org.eclipse.swt.widgets.Control.windowProc(
	at org.eclipse.swt.widgets.Canvas.windowProc(
	at org.eclipse.swt.widgets.Display.windowProc(
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(
	at org.eclipse.swt.widgets.Display.readAndDispatch(
	at org.eclipse.jface.window.Window.runEventLoop(
	at com.neighborhoodinnovations.ui.App.main(
Caused by: java.lang.RuntimeException: com.ardor3d.util.Ardor3dException: Error in opengl: out of memory
	at jogamp.opengl.GLDrawableHelper.execGLRunnables(
	at jogamp.opengl.GLDrawableHelper.display(
	at jogamp.opengl.GLAutoDrawableBase$
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(
	... 33 more
Caused by: com.ardor3d.util.Ardor3dException: Error in opengl: out of memory
	at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(
	at com.ardor3d.renderer.jogl.JoglRenderer.flushFrame(
	at com.ardor3d.framework.jogl.JoglCanvasRenderer.draw(
	... 37 more
Caused by: com.jogamp.opengl.GLException: out of memory
	at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(
	... 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>"

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
Report Content as Inappropriate

Re: my poor memory managment


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