[RFC] glx: fix DRI2 memory leak

Michel Dänzer michel at daenzer.net
Mon Apr 6 23:22:37 PDT 2009

On Mon, 2009-04-06 at 14:57 -0700, Jesse Barnes wrote:
> On Wed, 01 Apr 2009 17:46:08 +0200
> Michel Dänzer <michel at daenzer.net> wrote:
> > The real problem was pointed out by Pierre Willenbrock: If
> > glxPriv->pDraw is a pixmap, DrawableGone() destroys it, then later
> > DRI2DestroyDrawable dereferences it... The patch below seems to work
> > here - at least it hasn't crashed in a couple of hours, not sure about
> > the leak yet.
> > 
> > Note that unless I'm missing something, it might still be possible for
> > this to occur with windows if the underlying DrawableRec is freed
> > before this code is reached.
> > 
> > Also, I don't really understand the logic behind clearing
> > glxPriv->pDraw and ->drawId here. In particular, I'm not sure
> > DrawableGone will ever be called with glxPriv->refCount > 1. If it
> > won't, this change makes the assignments unreachable. And if it will,
> > we'll again leak because the cleanup code won't be able to get to the
> > underlying DrawableRec?
> So are you happy enough with this fix to push it, Michel?  Memory usage
> is still high on Intel after the fix, but that may be due to bo
> caching, and this is an important fix...

Feel free to push it. It's not really my fix, I just combined the fixes
and suggestions from others. :)

Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

More information about the xorg mailing list