Dear all,
Using the attached source code (also available at:
http://pastebin.com/yu3gwvM5 if you find it more convenient) valgrind
complains about a lot of memory leaks in Harfbuzz (latest revision), for
example:
==23594== 64 bytes in 1 blocks are definitely lost in loss record 5 of 6
==23594== at 0x402425F: calloc (vg_replace_malloc.c:467)
==23594== by 0x40BD126: hb_blob_create_sub_blob
(hb-object-private.hh:145)
==23594== by 0x40BFA06: _hb_face_for_data_get_table (hb-font.cc:385)
==23594== by 0x40BF7AE: hb_face_reference_table (hb-font.cc:453)
==23594== by 0x40C4554: _hb_ot_layout_create (hb-ot-layout.cc:60)
==23594== by 0x40BFB47: hb_face_create_for_tables (hb-font.cc:340)
==23594== by 0x40C07D6: hb_face_create_for_data (hb-font.cc:404)
==23594== by 0x40D0571: hb_ft_face_create (hb-ft.cc:215)
==23594== by 0x40D05B5: hb_ft_font_create (hb-ft.cc:253)
==23594== by 0x8048848: hb_stuff (in /tmp/a.out)
==23594== by 0x8048924: main (in /tmp/a.out)
==23594==
==23594== 400 bytes in 1 blocks are definitely lost in loss record 6 of
6
==23594== at 0x402425F: calloc (vg_replace_malloc.c:467)
==23594== by 0x40CF759: hb_ot_shape_plan_internal (hb-private.hh:255)
==23594== by 0x40CF831: hb_ot_shape (hb-ot-shape.cc:382)
==23594== by 0x40C0E6B: hb_shape (hb-shape.cc:48)
==23594== by 0x804886D: hb_stuff (in /tmp/a.out)
==23594== by 0x8048924: main (in /tmp/a.out)
I found those memory leaks in my application which used to work nicely
(without any leaks) until the recent upgrade and created this test case,
which also leaks, for you to test with.
Since it used to work and the code looks correct, I think it's a memory
leak, but it's possibly my misuse of the API. Please let me know.
Thanks,
Tom.
#include <hb-ft.h>
FT_Library ft_library;
static void
hb_stuff(FT_Face ft_face)
{
hb_font_t *hb_font;
hb_buffer_t *hb_buffer;
hb_glyph_info_t *hb_glyph;
const char *text = "test";
int len;
len = strlen (text);
hb_buffer = hb_buffer_create (0);
hb_buffer_add_utf8 (hb_buffer, text, len, 0, len);
hb_font = hb_ft_font_create (ft_face, NULL);
hb_shape (hb_font, hb_buffer, NULL, 0);
hb_font_destroy (hb_font);
hb_buffer_destroy (hb_buffer);
}
int
main(int argc, char *argv[])
{
FT_Face ft_face;
const char *ffile;
if (argc != 2)
{
printf("Usage: %s <font-file>\n", argv[0]);
exit(1);
}
ffile = argv[1];
FT_Init_FreeType (&ft_library);
if (FT_New_Face (ft_library, ffile, 0, &ft_face))
{
printf("Loading %s failed\n", ffile);
exit (1);
}
hb_stuff(ft_face);
FT_Done_Face(ft_face);
FT_Done_FreeType (ft_library);
}
_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz