Fix native allocation watermark clamping.
The main issue causing the test to fail is that
native_footprint_gc_watermark_ becoming > growth_limit_ due to no
clamping.
Temporary runFinalization fix is calling runFinalization 2x.
Bug: 17371542
(cherry picked from commit 4c7fc5950853b0c368e2148db77ced7c4d3c303c)
Change-Id: I05b85e95560c32c33d53bc96abf87d5262007395
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index a9ef8fc..db0a5c5 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -184,7 +184,7 @@
ThrowRuntimeException("allocation size negative %d", bytes);
return;
}
- Runtime::Current()->GetHeap()->RegisterNativeAllocation(env, bytes);
+ Runtime::Current()->GetHeap()->RegisterNativeAllocation(env, static_cast<size_t>(bytes));
}
static void VMRuntime_registerNativeFree(JNIEnv* env, jobject, jint bytes) {
@@ -193,7 +193,7 @@
ThrowRuntimeException("allocation size negative %d", bytes);
return;
}
- Runtime::Current()->GetHeap()->RegisterNativeFree(env, bytes);
+ Runtime::Current()->GetHeap()->RegisterNativeFree(env, static_cast<size_t>(bytes));
}
static void VMRuntime_updateProcessState(JNIEnv* env, jobject, jint process_state) {