Use runFinalizationWithTimeout for native allocations
Prevents deadlocks by not waiting longer than 250ms for finalizers
to complete.
(cherry picked from commit 3b532d744034b43ed329a3198f15846d80fec3f0)
Bug: 21544853
Change-Id: I57b2f7ae8b74185922eb3c15ba0ab71a4d2348aa
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index c72414a..81a9741 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -776,8 +776,8 @@
bool IsValidContinuousSpaceObjectAddress(const mirror::Object* obj) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- // Run the finalizers.
- void RunFinalization(JNIEnv* env);
+ // Run the finalizers. If timeout is non zero, then we use the VMRuntime version.
+ void RunFinalization(JNIEnv* env, uint64_t timeout);
// Blocks the caller until the garbage collector becomes idle and returns the type of GC we
// waited for.