[Mesa-dev] [PATCH 1/2] linker: fix strdup memory leak

Pekka Paalanen ppaalanen at gmail.com
Mon Dec 19 23:50:03 PST 2011


On Mon, 19 Dec 2011 11:02:31 -0800
Kenneth Graunke <kenneth at whitecape.org> wrote:

> On 12/19/2011 05:23 AM, Pekka Paalanen wrote:
> > On Fri, 16 Dec 2011 10:46:11 -0800
> > Ian Romanick <idr at freedesktop.org> wrote:
> > 
> >> On 12/14/2011 11:26 PM, Pekka Paalanen wrote:
> >>> string_to_uint_map::put() already does a strdup() for the key
> >>> argument, so we leak the memory allocated by strdup() in
> >>> link_uniforms.cpp.
> >>>
> >>> Remove the extra strdup(), fixes a few Valgrind detected leaks.
> >>
> >> Have you run piglit on this?  I seem to recall adding the extra
> >> strdup for a reason.  The hash table keeps a copy of the key
> >> pointer passed to it, and the underlying object may be deleted
> >> before the hash table is deleted.  This can happen if the back-end
> >> optimizes some uniforms away after the linker has generated the
> >> list of "active" uniforms.  I'm pretty sure there were one or two
> >> test cases that hit this on i965.
> > 
> > Sorry, I didn't. Finally got piglit running, though readPixSanity
> > failed on stencil values. Anyway it's running all.tests now for the
> > upstream Mesa master, and then I'll run it with my patches.
> 
> For future reference, you probably want to use quick.tests.  It skips
> valgrind and doesn't iterate over every single visual, so it takes a
> fraction of the time but still runs basically all the tests.

Thanks, I killed the first run after 17 hours. From the README I
gathered that quick.tests was somehow lacking and all.tests would be
preferable. Also, I had no idea of possible running times or what
"significantly" there meant.

- pq


More information about the mesa-dev mailing list