Expose query for cleaning memory and add memory limit flag (#100)
* Add memory flag, add additional meminfo utilities * Add free memory query
This commit is contained in:
committed by
Antonio Andelic
parent
dee885d69c
commit
cc56ac3dd8
@@ -3,6 +3,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <utils/memory_tracker.hpp>
|
||||
#include <utils/on_scope_exit.hpp>
|
||||
|
||||
TEST(MemoryTrackerTest, ExceptionEnabler) {
|
||||
utils::MemoryTracker memory_tracker;
|
||||
@@ -16,11 +17,15 @@ TEST(MemoryTrackerTest, ExceptionEnabler) {
|
||||
// wait until the second thread creates exception enabler
|
||||
while (!enabler_created)
|
||||
;
|
||||
ASSERT_NO_THROW(memory_tracker.Alloc(hard_limit + 1));
|
||||
ASSERT_EQ(memory_tracker.Amount(), hard_limit + 1);
|
||||
|
||||
// tell the second thread it can finish its test
|
||||
can_continue = true;
|
||||
// we use the OnScopeExit so the test doesn't deadlock when
|
||||
// an ASSERT fails
|
||||
utils::OnScopeExit thread_notifier{[&] {
|
||||
// tell the second thread it can finish its test
|
||||
can_continue = true;
|
||||
}};
|
||||
|
||||
ASSERT_NO_THROW(memory_tracker.Alloc(hard_limit + 1));
|
||||
}};
|
||||
|
||||
std::thread t2{[&] {
|
||||
|
||||
Reference in New Issue
Block a user