[cairo] cairo memory leak

Maarten Bosmans mkbosmans at gmail.com
Fri Oct 14 02:51:48 PDT 2011


2011/10/14 唐博 <hitiger.2008 at yahoo.com.cn>:
> I use cairo as this:
>
> cairo_move_to(cr, pPolyline->pPoints[0].x, pPolyline->pPoints[0].y);
> for (s = 1; s < pPolyline->count; ++s)
> {
>   cairo_line_to(cr, pPolyline->pPoints[s].x, pPolyline->pPoints[s].y);
> }
> cairo_stroke(cr);
> it will Memory leak. HookLogger said:
>>>>>_tr_malloc <C:\systemapi\src\system\memory\malloc.cpp #7> + 8 - Navidog2X.exe! 4de78a6b()
> __pixman_image_allocate <C:\workspaces\map9.1.5\src\XPixman_20110814\src\pixman-image.c #59> + 10 - Navidog2X.exe! 4df505bc()
> _pixman_image_create_solid_fill <C:\workspaces\map9.1.5\src\XPixman_20110814\src\pixman-solid-fill.c #77> + 5 - Navidog2X.exe! 4df56c94()
> __cairo_format_bits_per_pixel <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-image-surface.c #1076> + 9 - Navidog2X.exe! 4df3a088()
> __cairo_format_bits_per_pixel <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-image-surface.c #1670> + 8 - Navidog2X.exe! 4df3ba28()
> __cairo_format_bits_per_pixel <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-image-surface.c #3515> + 27 - Navidog2X.exe! 4df3f1e0()
> __cairo_format_bits_per_pixel <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-image-surface.c #2327> + 44 - Navidog2X.exe! 4df3cd61()
> __cairo_format_bits_per_pixel <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-image-surface.c #3579> + 32 - Navidog2X.exe! 4df3f396()
> __cairo_format_bits_per_pixel <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-image-surface.c #3680> + 36 - Navidog2X.exe! 4df3f659()
> __cairo_surface_stroke <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-surface.c #2184> + 41 - Navidog2X.exe! 4df471b4()
> __cairo_gstate_stroke <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo-gstate.c #1145> + 96 - Navidog2X.exe! 4df75ffc()
> _cairo_stroke_preserve <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo.c #2416> + 20 - Navidog2X.exe! 4df4181d()
> _cairo_stroke <C:\workspaces\map9.1.5\src\XCairo_20110815\src\cairo.c #2389> + 8

You need to compile with -O0 for this backtrace to be useful.
cairo_format_bits_per_pixel hardly a function that spans several
thousands lines of code and pixman_image_create_solid_fill is not
called from within cairo-image-surface.c, so the information you show
above is incorrect.

> I didn't find some wrong in pixman-image.c and cairo-image-surface.c . Who can tell me the reason.

My first guess would be a solid image cache.
Are you sure this is a real leak (if you draw and stroke the polygon
inside a loop, does the memory leak get larger?)

Maarten

> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list