Skip to content
Snippets Groups Projects
Commit 879b50ec authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Poor man's autocleanup of ICU in the test suite.

So tools like valgrind don't get too excited that there's still reachable but not freed memory.
parent 81a2b5a8
Branches
No related merge requests found
//#define BOOST_TEST_MODULE master
#include <boost/test/included/unit_test.hpp>
#include <unicode/uclean.h>
BOOST_AUTO_TEST_CASE(test_test)
{
......@@ -7,6 +8,20 @@ BOOST_AUTO_TEST_CASE(test_test)
BOOST_CHECK(a == 0);
}
//Auto cleanup of ICU with a static variable destructor.
//ICU can hold onto some memory resources until program exit,
//when the system is reclaiming them as usual. This is not a memory
//leak but makes tools like valgrind all excited that
//there is memory which is "still reachable but not freed."
//So, the below will perform icu cleanup before test program exit.
static struct ICU_cleaner
{
~ICU_cleaner()
{
u_cleanup();
}
} the_cleaner;
boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])
{
return 0;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment