2015-06-13 04:52:58 +02:00
|
|
|
#ifndef TEST_MEMORY_CLEANUP
|
|
|
|
#define TEST_MEMORY_CLEANUP
|
|
|
|
|
2020-11-19 15:30:30 +01:00
|
|
|
#include <mapnik/warning.hpp>
|
|
|
|
MAPNIK_DISABLE_WARNING_PUSH
|
2016-03-10 01:43:00 +01:00
|
|
|
#include <mapnik/warning_ignore.hpp>
|
|
|
|
|
2015-07-30 18:30:22 +02:00
|
|
|
#if defined(HAVE_LIBXML2)
|
2015-06-13 04:52:58 +02:00
|
|
|
#include <libxml/parser.h>
|
2015-06-13 05:22:54 +02:00
|
|
|
#include <libxml/entities.h>
|
|
|
|
#include <libxml/globals.h>
|
2015-07-30 13:13:53 +02:00
|
|
|
#endif
|
2015-06-13 05:22:54 +02:00
|
|
|
|
2015-06-13 04:52:58 +02:00
|
|
|
#if defined(HAVE_CAIRO)
|
|
|
|
#include <cairo.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <unicode/uclean.h>
|
|
|
|
|
2020-11-19 15:30:30 +01:00
|
|
|
MAPNIK_DISABLE_WARNING_POP
|
2016-03-10 01:43:00 +01:00
|
|
|
|
2015-06-13 04:52:58 +02:00
|
|
|
namespace testing {
|
|
|
|
|
2015-06-13 05:22:54 +02:00
|
|
|
inline void run_cleanup()
|
2015-06-13 04:52:58 +02:00
|
|
|
{
|
|
|
|
// only call this once, on exit
|
|
|
|
// to make sure valgrind output is clean
|
|
|
|
// http://xmlsoft.org/xmlmem.html
|
2015-07-30 18:30:22 +02:00
|
|
|
#if defined(HAVE_LIBXML2)
|
2015-06-13 04:52:58 +02:00
|
|
|
xmlCleanupCharEncodingHandlers();
|
2015-06-13 05:22:54 +02:00
|
|
|
xmlCleanupEncodingAliases();
|
|
|
|
xmlCleanupGlobals();
|
2015-06-13 04:52:58 +02:00
|
|
|
xmlCleanupParser();
|
2015-06-13 05:22:54 +02:00
|
|
|
xmlCleanupThreads();
|
|
|
|
xmlCleanupInputCallbacks();
|
|
|
|
xmlCleanupOutputCallbacks();
|
|
|
|
xmlCleanupMemory();
|
2015-07-30 13:13:53 +02:00
|
|
|
#endif
|
2015-06-13 04:52:58 +02: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();
|
|
|
|
}
|
|
|
|
|
2022-01-26 23:25:53 +01:00
|
|
|
} // namespace testing
|
2015-06-13 04:52:58 +02:00
|
|
|
|
2015-07-30 13:13:53 +02:00
|
|
|
#endif
|