Hey everyone, I recently discovered a memory leak in a program that I am running. I tracked it down to creation and deletion of shader/programs.
I wrote a test case and narrowed it down to this: (note: test case, I know this isn’t a functional pass)
static const char* TEST_SHADER = "void main ()
{
gl_FragColor = vec4(1.0, 0.0, 1.0, gl_Color.a);
}
\0";
GLhandleARB shader_program_handle = glCreateProgram ();
GLhandleARB fragment_shader_id = glCreateShader (GL_FRAGMENT_SHADER_ARB);glShaderSource (fragment_shader_id, 1, (const GLcharARB **) (&TEST_SHADER), 0);
// When we add the compileSource line, that is when the memory leak pops up
glCompileShader (fragment_shader_id);
glDeleteShader (fragment_shader_id); glDeleteProgram (shader_program_handle);
Upon deletion of the program, the memory is not freed. If I remove the compile portion, then the memory is freed up.
Has anyone seen this before?