3 Replies Latest reply on Dec 21, 2011 7:31 PM by eodabash

    Memory leaks with OpenGL function glCompileShader when using Catalyst 10.x / 11.x 32-bit/64-bit

    AntiLeaker
      Memory usage grows up at each call of glCompileShader with Catalyst 10.x / 11.x.

      (sorry for my technical english)

      There is no such problem on nVidia cards or with older Catalyst version 9.x. (eg 9.3, 9.10). This memory leak is a feature of latest Catalyst drivers 10.x /11.x both 32 and 64 bit version.

      I can test this leak only with my Radeon HD 4850, but probably there are same memory leaks occurs with other HD series videocards when used Catalyst drivers 10.x / 11.x 32-bit/64-bit for Windows XP/Windows 7 32-bit/64-bit.

      First example:

      while (1)

      {

      glCompileShader(ShaderObject);

      }


      According OpenGL specification this endless loop should not cause memory leaks or handle leaks. Memory usage should not grows up and handles count in system should not steadily increase.

      This is true when using Catalyst 9.x. But with latest Catalyst drivers, (for example, with Catalyst 11.8) there occur memory leak and handle leak.

      If Catalyst 10.x or 11.x is used then after 10000 iteration of glCompileShader our process have additional 10000 unclosed handles in system (1 unclosed handle per iteration) and almost 50 MB unfreed memory (about 5000 bytes leak per iteration).


      Second example:

      while (1)

      {

      glCompileShader(ShaderObject);

      glGetShaderiv(ShaderObject, GL_COMPILE_STATUS, &CompileStatus);

      }


      There is no difference between first and second examples on nVidia cards or when using Catalyst 9.x because in older catalyst drivers there are no memory and handle leaks in glCompileShader.

      But leaked Catalyst 10.x / 11.x drivers do some cleanup only when function glGetShaderiv or glGetShaderInfoLog is called after each glCompileShader. So, in second example there is no handle leak and memory leak... except about ~50 bytes leak per iteration (50 bytes is not so much as 5000 but older catalyst 9.x have 0 bytes leak even with endless loop of glCompileShader).



      Third example:

      while (1)

      {

      // Create window, OpenGL context and only 1 very simple shader

      ...


      glCompileShader(ShaderObject);

      glGetShaderiv(ShaderObject, GL_COMPILE_STATUS, &CompileStatus);

      // Delete shader, OpenGL context and window

      ...

      }





      Wow! In this case with latest catalyst drivers we have huge memory leak. About 2400-2600 KB per iteration!

      Comment line glCompileShader(ShaderObject); and memory usage does not grows up. Uncomment glCompileShader(ShaderObject); and we loose 2,5 MB per iteration!





      There is no such problem on nVidia cards.

      There is no such problem with older Catalyst 9.x

      This memory leak is a feature of latest Catalyst drivers 10.x /11.x both 32 and 64 bit version.





      Attachment and link

      20 KB zip-archive with C source code and Win32/64 bit binaries for tests:


      http://www.sendspace.com/file/me7216