Bug 1101

Summary: Memory leak on TextRenderer
Product: [JogAmp] Jogl Reporter: Tof <cgarrigues>
Component: openglAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: major CC: gouessej
Priority: ---    
Version: 2.4.0   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
1f0d7d4b416521ef56fdc81b28d128c7f3279188
Workaround: ---
Attachments: Proposed patch
Cleaned up Patch from original proposal

Description Tof 2014-11-03 17:55:24 CET
When using VBO, they are non released on dispose()
 in class Pipelined_QuadRenderer.
Lead to system memory leak when creating and deleting com.jogamp.opengl.util.awt.TexRenderer objects.
Comment 1 Tof 2014-11-04 13:22:18 CET
class Pipelined_QuadRenderer in TextRenderer.java,line 1786 :

                    gl.glGenBuffers(2, IntBuffer.wrap(vbos));

                    mVBO_For_ResuableTileVertices = vbos[0];
                    mVBO_For_ResuableTileTexCoords = vbos[1];
Comment 2 Tof 2014-11-04 13:25:35 CET
Created attachment 665 [details]
Proposed patch
Comment 3 Julien Gouesse 2015-03-31 16:41:01 CEST
Hi

You added a dispose() method into the main class:
public void dispose() {
             GL2 gl = GLContext.getCurrentGL().getGL2();
             int[] vbos = new int[2];
             vbos[0] = mVBO_For_ResuableTileVertices;
             vbos[1] = mVBO_For_ResuableTileTexCoords;
             gl.glDeleteBuffers(2, IntBuffer.wrap(vbos));
		}


and you improved the dispose() method of the debug listener:
@Override
        public void dispose(GLAutoDrawable drawable) {
        	mPipelinedQuadRenderer.dispose();
            glu.destroy();
            glu=null;
            frame=null;
        }

Please can you make a pull request?
Comment 4 Tof 2015-04-01 09:46:20 CEST
Sorry, but I don't know how to do it ... :(
Comment 5 Julien Gouesse 2015-04-01 13:05:03 CEST
(In reply to comment #4)
> Sorry, but I don't know how to do it ... :(

http://jogamp.org/wiki/index.php/How_to_Contribute
Comment 6 Julien Gouesse 2019-08-20 12:39:01 CEST
Someone else has the same problem:
http://forum.jogamp.org/TextRenderer-memory-leak-td4039967.html

Maybe we should consider using the proposed patch.
Comment 7 Sven Gothel 2019-08-20 18:27:28 CEST
Move version to 2.4.0.

Please test the proposed patch.

We need a unit test?
Comment 8 Sven Gothel 2019-08-20 18:48:24 CEST
Created attachment 819 [details]
Cleaned up Patch from original proposal
Comment 9 Sven Gothel 2019-08-20 18:52:24 CEST
(In reply to Tof from comment #2)
> Created attachment 665 [details]
> Proposed patch

Excellent work Tof, thank you!

I reviewed you code and indeed, the VBOs were not deleted.
Your patch fixes this leak, IMHO.

I added your patch and will push it soon
commit 1f0d7d4b416521ef56fdc81b28d128c7f3279188