[cairo] Issue with Font_Face reference count?

Chris Wilson chris at chris-wilson.co.uk
Sun Dec 14 10:37:22 PST 2008


On Sun, 2008-12-14 at 19:09 +0100, Anne et Damien Carbonne wrote:
> Whilst updating the Ada binding, I found a problem with font face ref 
> count in the binding.
> I wrote a small C example that reproduces the issue I have with Ada: 
> both versions have the same behaviour.
> So, either I wrongly use cairo, or there is an issue inside cairo.

This behaviour is entirely expected and is a side-effect of the caching
cairo performs to maintain a small number of 'holdover' scaled fonts to
reduce the frequency we need to recreate them and their associated
glyphs. When investigating memory leaks with cairo, it's advisable to
clear all of cairo's caches and associated data using
cairo_debug_reset_static_data() with the caveat being that you guarantee
that your application does not hold any references to cairo objects
itself.

>   cairo_surface_destroy (surface);
>   cairo_font_face_destroy (font_face);
>   cairo_destroy (context);

+ cairo_debug_reset_static_data ();
-- 
Chris



More information about the cairo mailing list