[cairo] memory leak in _cairo_pattern_create_solid

Carl Worth cworth at cworth.org
Tue Oct 16 10:39:12 PDT 2007


On Tue, 16 Oct 2007 12:27:33 -0400, Behdad Esfahbod wrote:
> Because there's not much point in doing that other than slowing down
> application shutdown.  And of course it's not portable and all...
> 
> Though now that you bring it up, I don't mind marking
> cairo_debug_reset_static_data() with __attribute__ ((destructor)).
> Carl, objections?

"There's no point in doing it... but we should do it" ? I don't
follow.

In general, I agree with your point that this will just slow down
application shutdown. There's a reason we put "debug" into the name of
this function---it's really only meant to be called while debugging.

But there's another issue which is that unconditionally calling
cairo_debug_reset_static_data will emit error messages unless the
application has first carefully cleaned up everything, (not holding an
references to cached data). In development-mozilla code has been in
this state for a while, (it would call cairo_debug_reset_static_data
without having done all cleanup and trigger an assertion failure crash
while exiting).

So I don't think it's a good idea. (Plus, it might tempt someone to
start depending on the "destructor" behavior within cairo's
implementation, but it's not at all portable.)

> On Tue, 2007-10-16 at 12:08 -0400, BJörn Lindqvist wrote:
>
> > I too have been puzzled by libraries leaving static caches around.

Yeah, it can be confusing. And that's exactly why we provide
cairo_debug_reset_static_data. Maybe we can advertise that better
someplace.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071016/34048475/attachment.pgp 


More information about the cairo mailing list