[cairo] memory leak in _cairo_pattern_create_solid

BJörn Lindqvist bjourne at gmail.com
Tue Oct 16 09:08:01 PDT 2007


On 10/12/07, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> The 'leak' is intentional as we keep a few solid patterns around to avoid
> having to continually allocate new patterns. In order to free up this
> and other static caches cairo maintains, call
> cairo_debug_reset_static_data() whilst exiting your code. You must be
> sure that you have released all of your own cairo objects - contexts,
> surfaces, patterns, fonts - before calling
> cairo_debug_reset_static_data().

Why can't cairo use a shared object finalizer to clean up after
itself? Something like this:

void
__attribute__ ((destructor))
cairo_died (void)
{
    cairo_debug_reset_static_data ();
}

I too have been puzzled by libraries leaving static caches around.


-- 
mvh Björn


More information about the cairo mailing list