Commit 9c3629c3 by Marcus Winter

containers_cpp: fixed memory leak in test, check for memory leaks after tests

parent a2efb0db
......@@ -60,7 +60,8 @@ n_threads(static_cast<int>
Pre(&HazardPointerTest::HazardPointerTest1_Pre, this).
Add(
&HazardPointerTest::HazardPointerTest1_ThreadMethod,
this, static_cast<size_t>(n_threads));
this, static_cast<size_t>(n_threads)).
Post(&HazardPointerTest::HazardPointerTest1_Post, this);
}
void HazardPointerTest::HazardPointerTest1_Pre() {
......@@ -75,6 +76,12 @@ void HazardPointerTest::HazardPointerTest1_Pre() {
1);
}
void HazardPointerTest::HazardPointerTest1_Post() {
delete object_pool;
delete stack;
delete hp;
}
void HazardPointerTest::HazardPointerTest1_ThreadMethod() {
unsigned int thread_index;
embb_internal_thread_index(&thread_index);
......
......@@ -59,6 +59,7 @@ class HazardPointerTest : public partest::TestCase {
*/
HazardPointerTest();
void HazardPointerTest1_Pre();
void HazardPointerTest1_Post();
void HazardPointerTest1_ThreadMethod();
void DeletePointerCallback(embb::base::Atomic<int>* to_delete);
};
......
......@@ -39,6 +39,8 @@
#include <embb/containers/lock_free_stack.h>
#include <embb/containers/lock_free_mpmc_queue.h>
#include <embb/base/c/memory_allocation.h>
#define COMMA ,
PT_MAIN("Data Structures C++") {
......@@ -67,4 +69,6 @@ PT_MAIN("Data Structures C++") {
PT_RUN(embb::containers::test::ObjectPoolTest
<embb::containers::WaitFreeArrayValuePool<bool COMMA false> >);
PT_EXPECT(embb_get_bytes_allocated() == 0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment