On 05/03/2013 09:42 AM, Andy Skinner wrote:
Hi, Brian.  Did you have thoughts one these?

Would it make sense, if we can't update Mesa right now, to just put the 
register_with_display() call into Fake_glXChooseFBConfig(), as it is for 
Fake_glxChooseVisual()?  It allows the visual to be cleaned up when the Display 
is closed.  Unless it introduces something else we'd have to chase down, we 
think we'd have to do a smaller job to make that change (for now) than to go to 
more recent Mesa.

Sounds fine.


Whether we do that or not, should destroy_visuals_on_display() free both the 
pointers that XMesaDestroyVisual() frees?  This looks like a leak to me, even 
in current Mesa.

I don't think so. There's several XVisualInfo pointers that we hang onto. Some come from the user/application (and we can't free those) and others are internal to Mesa's GLX. I'd have to study/fix the code to sort that out. We risk a double-free otherwise.

-Brian



thanks
andy

-----Original Message-----
From: Andy Skinner
Sent: Monday, April 29, 2013 1:04 PM
To: 'Brian Paul'
Cc: [email protected]
Subject: RE: [Mesa-dev] visual leak?

Thanks.  I realized today that newer Mesa registers the display with that 
callback for choosing FBConfig, but our older version only does it for Visual.  
So it isn't getting freed when we close the display.

Do you think the register_with_display() call can be put into 
Fake_glXChooseFBConfig() on its own?  We'd like to update Mesa, but it may not 
be a good time in our release cycle.

Also, destroy_visuals_on_display calls free, but XMesaDestroyVisual can also call 
free on v->visinfo.  Should destroy_visuals_on_display call XMesaDestroyVisual, 
or do both free()s?

thanks
andy

-----Original Message-----
From: Brian Paul [mailto:[email protected]]
Sent: Monday, April 29, 2013 11:39 AM
To: Andy Skinner
Cc: [email protected]
Subject: Re: [Mesa-dev] visual leak?

On 04/26/2013 03:23 PM, Andy Skinner wrote:
Hi. We are seeing a leak of things created in XMesaCreateVisual, as
called from fakeglx.c. I don't see anywhere that XMesaDestroyVisual is
called. I see a free() in destroy_visuals_on_display, but I don't know
how often that is called. Are these visuals intended to be kept around?

The visual is allocated in XMesaCreateVisual, from save_glx_visual,
from choose_visual, from Fake_glXChooseFBConfig.

It may be that the problem is that I'm not finding and reusing one in
the list, but separate from that, I am curious why XMesaDestroyVisual
isn't called.

Any thoughts?

There's no GLX function for explicitly destroying a visual so that's why 
XMesaDestroyVisual() isn't called.  Instead, we register an X display callback 
that's called when the X Display is closed which frees visuals and other things.

So, when you call XCloseDisplay, they should get freed.

-Brian

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to