PDA

View Full Version : Possible Memory Leak on ATI? (creation/deletion)



mathewm
08-19-2010, 12:09 PM
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 ()\n{\n gl_FragColor = vec4(1.0, 0.0, 1.0, gl_Color.a);\n}\n\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?

Alfonse Reinheart
08-19-2010, 12:32 PM
I wrote a test case and narrowed it down to this: (note: test case, I know this isn't a functional pass)

Why are you using ARB_shader_objects? You should be using the core functionality by now.

mathewm
08-19-2010, 02:09 PM
Whoops (please don't mind that), that was part of upgrading legacy code, both the versions boil down to the unsigned int anyway though.

Graham Sellers
08-23-2010, 12:59 PM
We recently went on a leak hunt and found a few, particularly in the shader compiler. We think we've found them all. Expect this to be fixed in an upcoming driver release.

mathewm
08-24-2010, 05:12 PM
Thank you so much!