2015-06-13 02:52:58 +00:00
|
|
|
#ifndef TEST_MEMORY_CLEANUP
|
|
|
|
#define TEST_MEMORY_CLEANUP
|
|
|
|
|
2015-07-30 16:30:22 +00:00
|
|
|
#if defined(HAVE_LIBXML2)
|
2015-06-13 02:52:58 +00:00
|
|
|
#include <libxml/parser.h>
|
2015-06-13 03:22:54 +00:00
|
|
|
#include <libxml/entities.h>
|
|
|
|
#include <libxml/globals.h>
|
2015-07-30 11:13:53 +00:00
|
|
|
#endif
|
2015-06-13 03:22:54 +00:00
|
|
|
|
2015-06-13 02:52:58 +00:00
|
|
|
#if defined(HAVE_CAIRO)
|
|
|
|
#include <cairo.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <unicode/uclean.h>
|
|
|
|
#ifdef MAPNIK_USE_PROJ4
|
|
|
|
#include <proj_api.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace testing {
|
|
|
|
|
2015-06-13 03:22:54 +00:00
|
|
|
inline void run_cleanup()
|
2015-06-13 02:52:58 +00:00
|
|
|
{
|
|
|
|
// only call this once, on exit
|
|
|
|
// to make sure valgrind output is clean
|
|
|
|
// http://xmlsoft.org/xmlmem.html
|
2015-07-30 16:30:22 +00:00
|
|
|
#if defined(HAVE_LIBXML2)
|
2015-06-13 02:52:58 +00:00
|
|
|
xmlCleanupCharEncodingHandlers();
|
2015-06-13 03:22:54 +00:00
|
|
|
xmlCleanupEncodingAliases();
|
|
|
|
xmlCleanupGlobals();
|
2015-06-13 02:52:58 +00:00
|
|
|
xmlCleanupParser();
|
2015-06-13 03:22:54 +00:00
|
|
|
xmlCleanupThreads();
|
|
|
|
xmlCleanupInputCallbacks();
|
|
|
|
xmlCleanupOutputCallbacks();
|
|
|
|
xmlCleanupMemory();
|
2015-07-30 11:13:53 +00:00
|
|
|
#endif
|
2015-06-13 02:52:58 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_CAIRO)
|
|
|
|
// http://cairographics.org/manual/cairo-Error-handling.html#cairo-debug-reset-static-data
|
|
|
|
cairo_debug_reset_static_data();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// http://icu-project.org/apiref/icu4c/uclean_8h.html#a93f27d0ddc7c196a1da864763f2d8920
|
|
|
|
u_cleanup();
|
|
|
|
|
|
|
|
#ifdef MAPNIK_USE_PROJ4
|
|
|
|
// http://trac.osgeo.org/proj/ticket/149
|
|
|
|
#if PJ_VERSION >= 480
|
|
|
|
pj_clear_initcache();
|
|
|
|
#endif
|
|
|
|
// https://trac.osgeo.org/proj/wiki/ProjAPI#EnvironmentFunctions
|
|
|
|
pj_deallocate_grids();
|
2015-07-30 11:13:53 +00:00
|
|
|
#endif
|
2015-06-13 02:52:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-30 11:13:53 +00:00
|
|
|
#endif
|