Fix valgrind gtests and memory leaks.
All tests pass other than image_test which passes if some bad reads
are disabled (buzbee working on this).
Change-Id: Ifd6b6e3aed0bc867703b6e818353a9f296609422
diff --git a/compiler/utils/arena_allocator.cc b/compiler/utils/arena_allocator.cc
index ec41293..00c3c57 100644
--- a/compiler/utils/arena_allocator.cc
+++ b/compiler/utils/arena_allocator.cc
@@ -112,7 +112,7 @@
void ArenaPool::FreeArena(Arena* arena) {
Thread* self = Thread::Current();
- if (UNLIKELY(RUNNING_ON_VALGRIND)) {
+ if (UNLIKELY(RUNNING_ON_VALGRIND > 0)) {
VALGRIND_MAKE_MEM_UNDEFINED(arena->memory_, arena->bytes_allocated_);
}
{
@@ -137,7 +137,7 @@
ptr_(nullptr),
arena_head_(nullptr),
num_allocations_(0),
- running_on_valgrind_(RUNNING_ON_VALGRIND) {
+ running_on_valgrind_(RUNNING_ON_VALGRIND > 0) {
memset(&alloc_stats_[0], 0, sizeof(alloc_stats_));
}