mesa: use atexit() handler to release GLSL compiler memory
authorBrian Paul <brianp@vmware.com>
Fri, 27 Aug 2010 17:54:32 +0000 (11:54 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 27 Aug 2010 20:30:59 +0000 (14:30 -0600)
This releases a bunch of memory that was showing up as leaks with
valgrind.

If atexit() isn't widely supported we may need to add some #ifdef
tests around the call.

src/mesa/main/context.c

index 6205d34..4852f46 100644 (file)
 #include "sparc/sparc.h"
 #endif
 
+#include "glsl_parser_extras.h"
+
+
+
 #ifndef MESA_VERBOSE
 int MESA_VERBOSE = 0;
 #endif
@@ -434,6 +438,11 @@ one_time_init( GLcontext *ctx )
    }
    _glthread_UNLOCK_MUTEX(OneTimeLock);
 
+   /* Hopefully atexit() is widely available.  If not, we may need some
+    * #ifdef tests here.
+    */
+   atexit(_mesa_destroy_shader_compiler);
+
    dummy_enum_func();
 }