diff options
Diffstat (limited to 'src/dalvik_system_VMRuntime.cc')
| -rw-r--r-- | src/dalvik_system_VMRuntime.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dalvik_system_VMRuntime.cc b/src/dalvik_system_VMRuntime.cc index 76da622203..feb7749b1f 100644 --- a/src/dalvik_system_VMRuntime.cc +++ b/src/dalvik_system_VMRuntime.cc @@ -19,7 +19,9 @@ #include "jni_internal.h" #include "object.h" #include "object_utils.h" +#include "space.h" #include "thread.h" +#include "thread_list.h" #include "JniConstants.h" // Last to avoid problems with LOG redefinition. #include "toStringArray.h" @@ -131,6 +133,13 @@ void VMRuntime_setTargetSdkVersion(JNIEnv* env, jobject, jint targetSdkVersion) } } +void VMRuntime_trimHeap(JNIEnv* env, jobject) { + ScopedThreadListLock thread_list_lock; + uint64_t start_ns = NanoTime(); + Heap::GetAllocSpace()->Trim(); + VLOG(gc) << "VMRuntime_trimHeap took " << PrettyDuration(NanoTime() - start_ns); +} + JNINativeMethod gMethods[] = { NATIVE_METHOD(VMRuntime, addressOf, "(Ljava/lang/Object;)J"), NATIVE_METHOD(VMRuntime, bootClassPath, "()Ljava/lang/String;"), @@ -144,6 +153,7 @@ JNINativeMethod gMethods[] = { NATIVE_METHOD(VMRuntime, properties, "()[Ljava/lang/String;"), NATIVE_METHOD(VMRuntime, setTargetSdkVersion, "(I)V"), NATIVE_METHOD(VMRuntime, startJitCompilation, "()V"), + NATIVE_METHOD(VMRuntime, trimHeap, "()V"), NATIVE_METHOD(VMRuntime, vmVersion, "()Ljava/lang/String;"), }; |