Hi Robert,

I found a memory leak in the shader class. See the attached file for the 
suggested bugfix. (I made the changes upon this day's trunk)

The leak occurs in the method 
void Shader::PerContextShader::compileShader(osg::State& state).

The problem only arises  in a gles2 environment (#if 
defined(OSG_GLES2_AVAILABLE)). At the beginning of the method a variable 
'formats' (a GLint pointer) is declared. In the case when a binary shader could 
be successfully loaded, the method is left with a return statement. In that 
case the variable 'formats' is not deleted anymore.
In the case when no binary format is available (numFormats==0) the whole block 
is never reached .If the binary shader could not be loaded, the memory is 
deleted as expected in the next line after the for loop that iterates over the 
available formats.

I have added a call into the described control path to delete the memory behind 
the 'formats' pointer, that should resolve the memory leak.

Cheers,
Johannes

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=37176#37176




Attachments: 
http://forum.openscenegraph.org//files/shader_111.zip


_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to