Bug 31128

Summary: Memory leak on multiple OSMesaMakeCurrent calls
Product: Mesa Reporter: dawhitehouse
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 7.8   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch to avoid recreating renderbuffer

Description dawhitehouse 2010-10-26 01:48:18 UTC
This is related to 29824. We're using version 7.8.2.

Our product makes a call to OSMesaCreateContextExt and then multiple calls to OSMesaMakeCurrent. The fix for 29824 fixed the assert we were getting but OSMesaMakeCurrent is leaking memory for every call after the first because it allocates a new renderbuffer.

At line 1331:

osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);

however in this situation osmesa->rb may already have been allocated.
Comment 1 Brian Paul 2010-10-26 08:29:49 UTC
Created attachment 39788 [details] [review]
patch to avoid recreating renderbuffer

Here's a quick patch to try.  I haven't tested it.
Comment 2 dawhitehouse 2010-10-27 02:52:32 UTC
Thanks very much. That seems to have done the trick.
Comment 3 Brian Paul 2010-10-30 09:11:54 UTC
OK, I've done additional testing and have committed the change: 9c2b4814d0b7dc67777099ea249c09bcf9ee46eb

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.