Add more checking to ReleasePrimitiveArray.
When we ReleasePrimitiveArray, we now check that the elements pointer
is not a heap address if it is not equal to the java array's data.
Bug: 12845603
Change-Id: I458862f4dc586ba1c414647c7eb81b978c4ccb7e
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 9c828b2..d98fe37 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -800,11 +800,12 @@
return IsAligned<kObjectAlignment>(obj) && IsHeapAddress(obj);
}
+bool Heap::IsNonDiscontinuousSpaceHeapAddress(const mirror::Object* obj) const {
+ return FindContinuousSpaceFromObject(obj, true) != nullptr;
+}
+
bool Heap::IsHeapAddress(const mirror::Object* obj) const {
- if (kMovingCollector && bump_pointer_space_ && bump_pointer_space_->HasAddress(obj)) {
- return true;
- }
- // TODO: This probably doesn't work for large objects.
+ // TODO: This might not work for large objects.
return FindSpaceFromObject(obj, true) != nullptr;
}