[PATCH] Initialize dev privates before using any

Keith Packard keithp at keithp.com
Thu Jul 1 06:55:01 PDT 2010


On Thu, 1 Jul 2010 16:42:38 +0300, Tiago Vignatti <tiago.vignatti at nokia.com> wrote:

> 1 PIXMAPs still allocated at reset
> PIXMAP: 1 objects of 40 bytes = 40 total bytes 0 private allocs

> TOTAL: 1 objects, 40 bytes, 0 allocs
>
> I don't think this is expected, right? If you need some help to track down
> some possible leaks here just tell me an easy way to do so.

Yes, you're leaking a pixmap, most likely a screen pixmap as your driver
isn't freeing it during server reset. I know that at least the intel
driver still leaks this pixmap. I thought I had posted a patch to fix
that, if not, here it is:

From 4f3397774a48a214755740f846e1eb8995a744bb Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp at keithp.com>
Date: Fri, 30 Apr 2010 13:33:14 -0700
Subject: [PATCH] Destroy screen pixmap on screen close.

This avoids a memory leak on server reset.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 uxa/uxa.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/uxa/uxa.c b/uxa/uxa.c
index a9a705c..dcfaaa9 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -381,6 +381,8 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 
 	uxa_glyphs_fini(pScreen);
 
+	(void) (*pScreen->DestroyPixmap) (pScreen->devPrivate);
+	pScreen->devPrivate = NULL;
 	pScreen->CreateGC = uxa_screen->SavedCreateGC;
 	pScreen->CloseScreen = uxa_screen->SavedCloseScreen;
 	pScreen->GetImage = uxa_screen->SavedGetImage;
-- 
1.7.1

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100701/6af6655a/attachment.pgp>


More information about the xorg-devel mailing list