Re: Has anyone used pango_font_get_coverage?


> I need to determine if a font contains a character, and PangoCoverage
> does exactly what I need; eg,
> PangoCoverage *coverage = pango_font_get_coverage(font, language);
> PangoCoverageLevel level = pango_coverage_get(pangoCoverage, index);
> My problem is that pango_font_get_coverage is leaving behind a
> monstrous memory leak.

I'm afraid you experienced caching but a leak.

Pango internally caches PangoCoverage objects for future reuse (in the
concerned PangoFontMap object.)  A PangoCoverage object returned by
pango_coverage_get is not released after the calling application
unref'ed it, because it is still in use in the cache.  This behaviour
is not a memory leak.

If it was a leak, repeating a sequence of calls to
pango_font_get_coverage, pango_coverage_get, then pango_coverage_unref
against same font and index many times will make used memory
increasing, and it will soon use up all available virtual memory.  On
the other hand, if it is a cache, the memory usage stays constant,
because in the second and later calls the same cached object is

If you believe you have found a leak, it will be better to report your
font renderer backend, because the implementation of
pango_font_get_coverage is backend-dependent.

    Alissa Sabre
Power up the Internet with Yahoo! Toolbar.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]