A simple call to GLUgl2.gluScaleImage() can consume all memory. For example: int widthin = 559; int heightin = 425; int widthout = 1024; int heightout = 512; int textureInLength = widthin * heightin * 4; int textureOutLength = widthout * heightout * 4; byte[] datain = new byte[textureInLength]; byte[] dataout = new byte[textureOutLength]; ByteBuffer bufferIn = ByteBuffer.wrap(datain); ByteBuffer bufferOut = ByteBuffer.wrap(dataout); GLUgl2 glu = new GLUgl2(); glu.gluScaleImage( GL.GL_RGBA, widthin, heightin, GL.GL_UNSIGNED_BYTE, bufferIn, widthout, heightout, GL.GL_UNSIGNED_BYTE, bufferOut ); This runs out of memory on an 8GB machine within seconds, then starts paging. CentOS 5.4, x86_64, Java 1.6.0_21-b06, JOGL autobuild b266.
Created attachment 222 [details] JOGL 2 unit test
Created attachment 223 [details] JOGL 1 unit test
Problem identified in Type_Widget. In JOGL 1, the constructor was: public Type_Widget() { buffer = ByteBuffer.allocate( 4 ); } In JOGL 2, it's this: public Type_Widget() { buffer = ByteBuffer.allocateDirect( 4 ); } When I change it back to how it was in JOGL 1, the unit test no longer eats all memory and crashes. Apparently creating these direct buffers inside the inner loops of Image.fill_image() and Image.empty_image() is more than the JVM can handle for some reason. With this fix, the unit test consumes hardly any memory; without the fix, it eats > 6GB before hitting the page file. I'll submit the JOGL2 unit test and fix as a pull request shortly.
merged, passed in #280