[Intel-gfx] [PATCH] Fix serious memory leak at Enter/LeaveVT

Lukas Hejtmanek xhejtman at ics.muni.cz
Wed Mar 4 22:29:48 CET 2009


Hello,

the patch below fixes huge memory leak at each VT switch (about 600 BOs + 6MB
of RSS of Xserver).

Signed-off-by: Lukas Hejtmanek <xhejtman at ics.muni.cz>

iff --git a/src/i965_render.c b/src/i965_render.c
index de1c8b3..ee0b6ff 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1715,7 +1715,7 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     struct gen4_render_state *render_state= pI830->gen4_render_state;
-    int i;
+    int i,j,k,l,m;
 
     if (render_state->vertex_buffer_bo) {
        dri_bo_unreference (render_state->vertex_buffer_bo);
@@ -1734,6 +1734,15 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn)
        drm_intel_bo_unreference(render_state->wm_kernel_bo[i]);
        render_state->wm_kernel_bo[i] = NULL;
     }
+
+    for (i = 0; i < SAMPLER_STATE_FILTER_COUNT; i++) 
+       for (j = 0; j < SAMPLER_STATE_EXTEND_COUNT; j++) 
+           for (k = 0; k < SAMPLER_STATE_FILTER_COUNT; k++)
+               for (l = 0; l < SAMPLER_STATE_EXTEND_COUNT; l++) 
+                      for (m = 0; m < WM_KERNEL_COUNT; m++) {
+                               drm_intel_bo_unreference(render_state->wm_state_bo[m][i][j][k][l]);
+                               render_state->wm_state_bo[m][i][j][k][l] = 0;
+                      }
     drm_intel_bo_unreference(render_state->sip_kernel_bo);
     render_state->sip_kernel_bo = NULL;
 }


-- 
Lukáš Hejtmánek



More information about the Intel-gfx mailing list