[cairo] memory leaks

Eric Feillant eric.feillant at live-media.fr
Tue Jan 25 08:52:36 UTC 2022


Hi,

My program using cairo read a text file and gives values to some 
show_text vars.
After several hours the program (suid bit root to access hardware 
device) crashes the linux kernel and as i can see this is because
my cairo/text program consume all the memory , step by step.  I've heard 
that it's a known problem
with cairo_show_text and i should use "cairo_debug_reset_static_data();" 
to clear some cache but i don't know
how to use it. Can anyone help ?

Thanks


Here's the small code:

         cairo_t *cr = render_context;
         cairo_surface_t *surface;
         surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 
OVERLAY_WIDTH, OVERLAY_HEIGHT);
         render_context = cairo_create(surface);

         cairo_set_source (cr, couleur);
         cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
         cairo_paint(cr);

         cairo_select_font_face(cr, "monospace", 
CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD);
         cairo_set_font_size(cr, 12.0);
         cairo_set_source_rgb(cr, 1.0, 1.0, 0.9);

         cairo_set_line_width(cr, 0.2);
         cairo_move_to (cr, 8,25);
         cairo_line_to (cr, 266,25);
         cairo_stroke (cr);

         cairo_move_to(cr, 8, 18);
         cairo_show_text(cr, match.joueur[0].nom);
         cairo_move_to(cr, 8, 40);
         cairo_show_text(cr, match.joueur[1].nom);

-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20220125/f9f346f5/attachment.htm>


More information about the cairo mailing list