diff options
| -rw-r--r-- | runtime/gc/heap.cc | 2 | ||||
| -rw-r--r-- | runtime/gc/heap.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index e03b6f71ae..a962f0693f 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -1161,7 +1161,7 @@ mirror::Object* Heap::AllocateInternalWithGc(Thread* self, AllocatorType allocat } ptr = TryToAllocate<true, true>(self, allocator, alloc_size, bytes_allocated, usable_size); if (ptr == nullptr) { - ThrowOutOfMemoryError(self, alloc_size, false); + ThrowOutOfMemoryError(self, alloc_size, allocator == kAllocatorTypeLOS); } return ptr; } diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index e11671b7c7..e568b36ae9 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -408,7 +408,7 @@ class Heap { // Implements java.lang.Runtime.freeMemory. size_t GetFreeMemory() const { - return GetTotalMemory() - num_bytes_allocated_.LoadSequentiallyConsistent(); + return GetMaxMemory() - num_bytes_allocated_.LoadSequentiallyConsistent(); } // get the space that corresponds to an object's address. Current implementation searches all |