Created attachment 28923 [details] a small OpenGL program triggering the issue It seems like there's a leak in the texture management code of the i965 driver. I've attached a simple OpenGL program which gets killed by the Linux kernel Out-Of-Memory killer. The program creates a 1024x1024 RGBA texture, uploads a buffer, renders a textured quad and deletes the texture in a loop. See below a snippet of the OpenGL code involved. /* Create a 1024x1024 RGBA texture */ glGenTextures (1, &tex); glBindTexture (GL_TEXTURE_2D, tex); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, (void*) buffer); /* Render a texture mapped quad */ glEnableClientState (GL_VERTEX_ARRAY); glEnableClientState (GL_COLOR_ARRAY); glEnableClientState (GL_TEXTURE_COORD_ARRAY); glVertexPointer (3, GL_FLOAT, 0, positions); glColorPointer (4, GL_UNSIGNED_BYTE, 0, colors); glTexCoordPointer (2, GL_FLOAT, 0, texcoords); glDrawElements (GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_SHORT, indices); glDisableClientState (GL_VERTEX_ARRAY); glDisableClientState (GL_COLOR_ARRAY); glDisableClientState (GL_TEXTURE_COORD_ARRAY); /* Delete the texture */ glBindTexture (GL_TEXTURE_2D, 0); glDeleteTextures (1, &tex); This bug has been detected with various Mesa versions including Fedora11 with mesa-dri-drivers-7.6.0.1.fc11 and Ubuntu Jaunty with libgl1-mesa-dri-7.4-0ubuntu3.
commit 49fbdd18ed738feaf73b7faba4d3577cd9cc3e59 Author: Eric Anholt <eric@anholt.net> Date: Thu Feb 12 03:54:58 2009 -0800 i965: Fix massive memory allocation for streaming texture usage. Once we've freed a miptree, we won't see any more state cache requests that would hit the things that pointed at it until we've let the miptree get released back into the BO cache to be reused. By leaving those surface state and binding table pointers that pointed at it around, we would end up with up to (500 * texture size) in memory uselessly consumed by the state cache. Bug #20057 Bug #23530
Also, thanks for providing a small testcase. I re-did the same idea in piglit so we'll make sure this doesn't happen again.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.