Login  Register

Re: JOGL OpenGL ES error in NetBeans

Posted by gouessej on Oct 27, 2015; 2:14pm
URL: https://forum.jogamp.org/JOGL-OpenGL-ES-error-in-NetBeans-tp4035582p4035615.html

I advise you to look at the source code of OpenJDK instead of assuming that the content of this SO post is true but actually, you seem to have misunderstood it a little bit. The garbage collector will effectively release the memory of a direct NIO buffer on the native heap when it releases the memory of an object referring to it on the Java heap. However, if you run out of native memory before running out of Java memory, you'll be out of luck (unable to create another direct NIO buffer, OutOfMemoryError). I quoted a document written by IBM about this subject, I don't remember where it is but I can probably find it again...

Moreover, this simplistic code doesn't handle as much cases as my deallocator helper, this code only treats the most trivial case of a direct NIO buffer created by calling ByteBuffer.allocateDirect().

Finally, read carefully the end of the comment in the post you quote. The suggested hack is almost necessary to avoid an OutOfMemoryError.
Julien Gouesse | Personal blog | Website