From 9ba195cfd35b967b0e9f3098d52619d726228921 Mon Sep 17 00:00:00 2001 From: Marcus Winter Date: Thu, 29 Jan 2015 10:07:51 +0100 Subject: [PATCH] base_c: checked for memory leaks in tests --- base_c/test/alloc_test.cc | 6 ++++++ base_c/test/main.cc | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/base_c/test/alloc_test.cc b/base_c/test/alloc_test.cc index 9ac33ee..0e32bb8 100644 --- a/base_c/test/alloc_test.cc +++ b/base_c/test/alloc_test.cc @@ -177,6 +177,12 @@ void AllocTest::TestMixedAllocs() { expected += (1 + 1) * EMBB_CACHE_LINE_SIZE + 3 * sizeof(size_t) - 1; #endif // else EMBB_DEBUG PT_EXPECT_EQ(allocated, expected); + + embb_free(plain); + embb_free_aligned(aligned); + embb_free_aligned(cache_aligned); + + PT_EXPECT(embb_get_bytes_allocated() == 0); } } // namespace test diff --git a/base_c/test/main.cc b/base_c/test/main.cc index 557f641..eb0dc83 100644 --- a/base_c/test/main.cc +++ b/base_c/test/main.cc @@ -39,6 +39,8 @@ #include #include +#include + PT_MAIN("Base C") { embb_log_set_log_level(EMBB_LOG_LEVEL_WARNING); unsigned int max_threads = @@ -55,4 +57,6 @@ PT_MAIN("Base C") { PT_RUN(embb::base::test::ConditionVarTest); PT_RUN(embb::base::test::ThreadTest); PT_RUN(embb::base::test::ThreadSpecificStorageTest); + + PT_EXPECT(embb_get_bytes_allocated() == 0); } -- libgit2 0.26.0