mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 21:48:24 +02:00
Free all memory when cairo-perf exits.
Similar to cairo-test, we free any global memory used by cairo for its caches through the debug interfaces. We do this so that valgrind does not unnecessary warn about memory leaks for the cached data and any true leak is then not lost in the noise.
This commit is contained in:
parent
7e6ab5461c
commit
a5d1fc923f
1 changed files with 19 additions and 0 deletions
|
|
@ -34,6 +34,10 @@
|
|||
/* For basename */
|
||||
#include <libgen.h>
|
||||
|
||||
#if HAVE_FCFINI
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SCHED_H
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
|
@ -299,6 +303,16 @@ check_cpu_affinity(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
cairo_perf_fini (void)
|
||||
{
|
||||
cairo_debug_reset_static_data ();
|
||||
#if HAVE_FCFINI
|
||||
FcFini ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -351,6 +365,8 @@ main (int argc, char *argv[])
|
|||
fprintf (stderr,
|
||||
"Error: Failed to create target surface: %s\n",
|
||||
target->name);
|
||||
cairo_boilerplate_free_targets (targets);
|
||||
cairo_perf_fini ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
|
@ -364,6 +380,8 @@ main (int argc, char *argv[])
|
|||
if (cairo_status (perf.cr)) {
|
||||
fprintf (stderr, "Error: Test left cairo in an error state: %s\n",
|
||||
cairo_status_to_string (cairo_status (perf.cr)));
|
||||
cairo_boilerplate_free_targets (targets);
|
||||
cairo_perf_fini ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
|
@ -377,6 +395,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
cairo_boilerplate_free_targets (targets);
|
||||
cairo_perf_fini ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue