[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Python or OpenGL Memory Leak in Debian 3.1r0




I encountered a memory leak in my python code that imports OpenGL. Either python or its OpenGL import is not freeing memory. I use Debian 3.1r0 and the most current python and python-opengl packages from there (python version 2.3.5). Here's an example python program that has the memory leak.

------------------------------------------------------------------
# Stand-alone test of glReadPixels.  There is an obvious memory leak.

from OpenGL.GL import *
from OpenGL.GLUT import *

import sys

def KeyMotion(key, x, y):
    if key != 'q':
        viewport = glGetIntegerv(GL_VIEWPORT)
        a = glReadPixelsf(viewport[0], viewport[1],
                          viewport[2], viewport[3], GL_RGB)
        glutPostRedisplay()
    else:
        sys.exit(0)

def DrawStuff():
    pass

glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowPosition(0, 0)
glutInitWindowSize(400, 400)
glutCreateWindow('Test')
glutDisplayFunc(DrawStuff)
glutKeyboardFunc(KeyMotion)
glClearColor(0.0, 0.0, 0.0, 0.0)
glClear(GL_COLOR_BUFFER_BIT)
glutMainLoop()
------------------------------------------------------------------

The glReadPixels line grabs memory every time it is called, and it is never released. I'm not sure where to post this bug, because I cannot tell which package causes the bug. (If I had to guess, I think OpenGL is the culprit.) Can anyone help direct me to the proper place to post this bug?

Thanks,
Charles
sharman@pcisys.net



Reply to: