diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-04-30 16:05:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-04-30 16:06:47 +0100 |
commit | a5d1fc923fdef354ceed8478c93e8b7cb734158a (patch) | |
tree | c2b8ee41bccf7d87575436181991dad80641cc0e /perf | |
parent | 7e6ab5461c2eb75c948bcb4725613ebe826c697a (diff) |
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.
Diffstat (limited to 'perf')
-rw-r--r-- | perf/cairo-perf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c index 1363f89f8..af06bb695 100644 --- a/perf/cairo-perf.c +++ b/perf/cairo-perf.c @@ -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; } |