Add Heap::RunningOnValgrind and call it from the spaces.
Makes it easier to disable valgrind support.
Change-Id: I1bde792f1b76a2dd968fa03c6142e92fcc3670b0
diff --git a/runtime/gc/space/rosalloc_space.cc b/runtime/gc/space/rosalloc_space.cc
index 80c7ca7..fbb2afe 100644
--- a/runtime/gc/space/rosalloc_space.cc
+++ b/runtime/gc/space/rosalloc_space.cc
@@ -65,7 +65,7 @@
byte* begin = mem_map->Begin();
// TODO: Fix RosAllocSpace to support valgrind. There is currently some issues with
// AllocationSize caused by redzones. b/12944686
- if (false && RUNNING_ON_VALGRIND > 0) {
+ if (false && Runtime::Current()->GetHeap()->RunningOnValgrind()) {
return new ValgrindMallocSpace<RosAllocSpace, allocator::RosAlloc*>(
name, mem_map, rosalloc, begin, end, begin + capacity, growth_limit, initial_size);
} else {