Frage

In my program, even if do all the obvious housekeeping, such as calling cairo_destroy(), cairo_surface_destroy()..., valgrind always finds memory leaks, the leaks are in cairo dependencies (freetype, pixman, ...). How do I cleanup after cairo, so that valgrind won't detect any leaks, or are the leaks normal?

Sample output

==1861== HEAP SUMMARY:
==1861==     in use at exit: 1,996,663 bytes in 532 blocks
==1861==   total heap usage: 21,915 allocs, 21,383 frees, 95,411,698 bytes allocated
==1861== 
==1861== LEAK SUMMARY:
==1861==    definitely lost: 0 bytes in 0 blocks
==1861==    indirectly lost: 0 bytes in 0 blocks
==1861==      possibly lost: 0 bytes in 0 blocks
==1861==    still reachable: 1,996,663 bytes in 532 blocks
==1861==         suppressed: 0 bytes in 0 blocks
==1861== Reachable blocks (those to which a pointer was found) are not shown.
==1861== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==1861== 
==1861== For counts of detected and suppressed errors, rerun with: -v
==1861== Use --track-origins=yes to see where uninitialised values come from
==1861== ERROR SUMMARY: 1961 errors from 7 contexts (suppressed: 1 from 1)

UPDATE:

This question says, the "leaks" are normal, does there exist a way to do the cleanup, so valgrind becomes happy?

War es hilfreich?

Lösung

For cairo there is cairo_debug_reset_static_data().

While writing this as a comment, I was looking into pixman's source and the implementation of _pixman_choose_implementation() and apparently you cannot "clean up" pixman.

I have no clue about freetype.

Edit: For fontconfig (related to freetype, so possibly interesting here), there is FcFini().

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top