hemesh: import of obj => OutOfMemoryError

edited May 2016 in Library Questions


i am trying to load an obj-file (http://www.i-am-digital.de/bottle2.obj) with HEC_FromObjFile:

public void setup() {
  size(1000, 1000, P3D);    
  mesh = new HEC_FromObjFile(sketchPath("bottle2.obj")).create();

the call to the HEC_FromObjFile-contructor runs for several minutes and then i get the attached exception. when i load the obj-file with loadShape i can display it without problems.

can anyone help me?

java.lang.RuntimeException: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
    at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:100)
    at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:205)
    at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
    at javax.media.opengl.Threading.invoke(Threading.java:191)
    at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:483)
    at processing.opengl.PGL.requestDraw(PGL.java:1149)
    at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1604)
    at processing.core.PApplet.run(PApplet.java:2176)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.LinkedList.addBefore(LinkedList.java:778)
    at java.util.LinkedList.add(LinkedList.java:198)
    at wblut.hemesh.HEC_FromFacelist.createBase(HEC_FromFacelist.java:326)
    at wblut.hemesh.HEC_Creator.create(HEC_Creator.java:187)
    at wblut.hemesh.HE_Mesh.<init>(HE_Mesh.java:98)
    at wblut.hemesh.HEC_FromObjFile.createBase(HEC_FromObjFile.java:111)
    at wblut.hemesh.HEC_Creator.create(HEC_Creator.java:187)
    at test_obj.setup(test_obj.java:49)
    at processing.core.PApplet.handleDraw(PApplet.java:2280)
    at processing.opengl.PGL$PGLListener.display(PGL.java:2601)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:588)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:572)
    at javax.media.opengl.awt.GLCanvas$7.run(GLCanvas.java:1054)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1034)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:909)
    at javax.media.opengl.awt.GLCanvas$8.run(GLCanvas.java:1065)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:666)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:627)
    at java.awt.EventQueue$2.run(EventQueue.java:625)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:636)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


  • Try to give your sketch more memory ...

    Settings / Increase maximum available memory to ... 1024 ... MB


  • edited October 2013

    with this obj-file: http://www.i-am-digital.de/Wineglass.obj i do not get an exception but the import is literally running forever. never comes to an end. loadShape works for this file.

    i tried several obj-files so far. the hemesh import didn't work for any of these files. only some could be loaded with loadShape and displayed.

    now i am asking myself if obj support is usable at all at the moment. any opinions/experiences on that?

  • @darius thanks. i tried that. the stacktrace changed but it's still an OutOfMemoryException.

    java.lang.OutOfMemoryError: Java heap space
        at java.lang.reflect.Array.newArray(Native Method)
    An OutOfMemoryError means that your code is either using up too much memory
    because of a bug (e.g. creating an array that's too large, or unintentionally
        at java.lang.reflect.Array.newInstance(Array.java:52)
        at java.util.Arrays.copyOf(Arrays.java:2760)
        at java.util.ArrayList.toArray(ArrayList.java:305)
        at sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScreenUpdateManager.java:429)
        at java.lang.Thread.run(Thread.java:662)
    loading thousands of images), or that your sketch may need more memory to run.
    If your sketch uses a lot of memory (for instance if it loads a lot of data files)
    you can increase the memory available to your sketch using the Preferences window.
  • edited October 2013 Answer ✓

    I didn't find the HEC_FromObjFile class (libraries/hemesh/doc/index.html) in the documentation. Which version do you use?


    Maybe we can improve the HEC_FromObjFile hack with threads or similar techniques.


    I believe, that you develop with Eclipse (b/c of the public visibility), so add that line to your JVM environment. Run / Run configurations / Arguments / VM arguments

    -Xms1024m -Xmx1024m

  • fuck you are right. i missed the last update of hemesh and now the import class is gone. for a reason i guess. damn, now i have to find a different way to get modells into hemesh.

    maybe i can use stl import of toxiclibs and import the toxiclibs mesh in hemesh.

    thanks darius

  • You are welcome!

  • have have you resolved? i'm facing the same problem.. seems that translating the mesh from toxic to he mesh is the way..

Sign In or Register to comment.