<div>Hello everybody,</div>
<div>&nbsp;</div>
<div>First of all i want to say that the cairo lib is really nice, i really enjoy using it.</div>
<div>&nbsp;</div>
<div>I often use Valgrind to check memory leaks and other issues, and i think there could be a little something in the cairo lib.</div>
<div>The 2 functions that could be incriminated are cairo_font_extents &amp; cairo_text_extents, i didn&#39;t find any destroy/free method in the sources and documentation.</div>
<div>Those 2 functions are supposed to fill structs and free all what has been used, that&#39;s why the fact that&nbsp;no destroy/free methods makes sense.</div>
<div>&nbsp;</div>
<div>Here is how i use them :</div>
<div>&nbsp;</div>
<div>cas = cairo_xlib_surface_create(dpy, win, visual, RESX, RESY);<br>cr = cairo_create(cas);<br>[...]</div>
<div>cairo_font_extents(cr, &amp;f_ext);&nbsp;<br>[...]</div>
<div>cairo_text_extents(cr, str, &amp;t_ext);<br>[...]</div>
<div>cairo_destroy(cr);<br>cairo_surface_destroy(cas);&nbsp;&nbsp;<br>&nbsp;</div>
<div>I use TTF fonts i think it uses&nbsp;the freetype lib.</div>
<div>&nbsp;</div>
<div>Here is what Valgrind says after execution : </div>
<div>&nbsp;</div>
<div>==28357== 12 bytes in 1 blocks are still reachable in loss record 1 of 2<br>==28357==&nbsp;&nbsp;&nbsp; at 0x4019854: malloc (vg_replace_malloc.c:149)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x41AA428: _cairo_ft_unscaled_font_map_create (cairo-ft-font.c
 :178)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x41AA5F4: _cairo_ft_unscaled_font_map_lock (cairo-ft-font.c:254)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x41AA8DD: _cairo_ft_unscaled_font_create_for_pattern (cairo-ft-font.c:406)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x41AC7F0: _cairo_ft_scaled_font_create_toy ( 
cairo-ft-font.c:1600)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x41922AC: _cairo_toy_font_face_scaled_font_create (cairo-font-face.c:459)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x419C767: cairo_scaled_font_create (cairo-scaled-font.c:530)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x41942C5: _cairo_gstate_ensure_scaled_font ( 
cairo-gstate.c:1447)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x419430F: _cairo_gstate_get_font_extents (cairo-gstate.c:1464)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x418D3BC: cairo_font_extents (cairo.c:2495)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x8054734: dt_create (obj_drawtext.c:401) 
<br>&nbsp;</div>
<div>&nbsp;</div>
<div>==28357== 292 bytes in 1 blocks are still reachable in loss record&nbsp;2 of 2<br>==28357==&nbsp;&nbsp;&nbsp; at 0x401AC64: calloc (vg_replace_malloc.c:279)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x4194B40: _cairo_hash_table_resize (cairo-hash.c:330)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x4194DC1: _cairo_hash_table_insert ( 
cairo-hash.c:483)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x4190942: _cairo_cache_insert (cairo-cache.c:307)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x419DEA1: _cairo_scaled_glyph_lookup (cairo-scaled-font.c:1527)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x419CEEE: _cairo_scaled_font_text_to_glyphs ( 
cairo-scaled-font.c:930)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x4194391: _cairo_gstate_text_to_glyphs (cairo-gstate.c:1487)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x418D71A: cairo_text_extents (cairo.c:2794)<br>==28357==&nbsp;&nbsp;&nbsp; by 0x8053C3D: dt_fill_multi_line_count (obj_drawtext.c:152) 
<br>&nbsp;</div>
<div>Thanks in advance to help</div>
<div>Yann</div><span class="sg">
<div>&nbsp;</div></span>