Index: runtime/vm/malloc_hooks_test.cc |
diff --git a/runtime/vm/malloc_hooks_test.cc b/runtime/vm/malloc_hooks_test.cc |
index 5054a5047dd0f09c6f4de145c68b79e9b8676740..791e2694aa9deff839b4454d2137c52575820a64 100644 |
--- a/runtime/vm/malloc_hooks_test.cc |
+++ b/runtime/vm/malloc_hooks_test.cc |
@@ -26,6 +26,9 @@ static void MallocHookTestBufferInitializer(volatile char* buffer, |
UNIT_TEST_CASE(BasicMallocHookTest) { |
+ bool enable_malloc_hooks_saved = FLAG_enable_malloc_hooks; |
+ FLAG_enable_malloc_hooks = true; |
+ |
MallocHooks::InitOnce(); |
MallocHooks::ResetStats(); |
EXPECT_EQ(0L, MallocHooks::allocation_count()); |
@@ -42,10 +45,15 @@ UNIT_TEST_CASE(BasicMallocHookTest) { |
EXPECT_EQ(0L, MallocHooks::allocation_count()); |
EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes()); |
MallocHooks::TearDown(); |
+ |
+ FLAG_enable_malloc_hooks = enable_malloc_hooks_saved; |
} |
UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { |
+ bool enable_malloc_hooks_saved = FLAG_enable_malloc_hooks; |
+ FLAG_enable_malloc_hooks = true; |
+ |
MallocHooks::InitOnce(); |
const intptr_t pre_hook_buffer_size = 3; |
char* pre_hook_buffer = new char[pre_hook_buffer_size]; |
@@ -73,6 +81,8 @@ UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { |
EXPECT_EQ(0L, MallocHooks::allocation_count()); |
EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes()); |
MallocHooks::TearDown(); |
+ |
+ FLAG_enable_malloc_hooks = enable_malloc_hooks_saved; |
} |
}; // namespace dart |