Last active
August 29, 2015 13:57
-
-
Save rygorous/9559632 to your computer and use it in GitHub Desktop.
DYI GL object leak checker.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void check_for_leaks() | |
{ | |
GLuint max_id = 10000; // better idea would be to keep track of assigned names. | |
GLuint id; | |
// if brute force doesn't work, you're not applying it hard enough | |
for ( id = 1 ; id <= max_id ; id++ ) | |
{ | |
#define CHECK( type ) if ( glIs##type( id ) ) fprintf( stderr, "GLX: leaked " #type " handle 0x%x\n", (unsigned int) id ) | |
CHECK( Texture ); | |
CHECK( Buffer ); | |
CHECK( Framebuffer ); | |
CHECK( Renderbuffer ); | |
CHECK( VertexArray ); | |
CHECK( Shader ); | |
CHECK( Program ); | |
CHECK( ProgramPipeline ); | |
#undef CHECK | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment