[Fontconfig] FontConfig memory question

Behdad Esfahbod behdad at behdad.org
Sat Feb 15 00:10:08 CET 2014


On Feb 14, 2014 5:12 PM, "mathog" <mathog at caltech.edu> wrote:
>
> On 14-Feb-2014 11:47, mathog wrote:
>>
>> I'm thinking it will probably come down to building a debug version of
>> fontconfig, linking with that, and then tracking a whole lot of
>> pointers.
>
>
>  The bad news: Inkscape still can't run FcFini() just before exit without
crashing.

Try:

  pango_cairo_font_map_set_default (NULL);
  cairo_debug_reset_static_data ();
  FcFini ();

(On cell phone.)

behdad
>
> Ran inkscape in valgrind while it was linked with the 2.11 library
compiled with -g, and traced a huge number of memory leaks into
FcValueSave.  These 3 lines leak when that function is called from numerous
locations:
>
>         v.u.s = FcStrdup (v.u.s);
>         v.u.m = FcMatrixCopy (v.u.m);
>         v.u.l = FcLangSetCopy (v.u.l);
>
> but this one doesn't
>
>         v.u.c = FcCharSetCopy ((FcCharSet *) v.u.c);
>
> What is this code trying to do?  Because in general
>
>    sometype var;
>    /* set the values in var */
>    var = duplicate_function(var);
>
> is going to leak if sometype has pointers to memory.  The surprising
thing here is not that the 3 lines noted leak, but that FcCharSetCopy
doesn't.  FcValueSave is called from 4 locations in fcpat.c, and all of
them leaked.  The only other place FcValueSave seemed to be used was in
fccfg.c, but that included fcaliastail.h, which redefines FcValueSave so
that the function by that name is not called.
>
> Regards,
>
>
> David Mathog
> mathog at caltech.edu
> Manager, Sequence Analysis Facility, Biology Division, Caltech
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/fontconfig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20140214/e80a0e2f/attachment.html>


More information about the Fontconfig mailing list