diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-05-14 15:44:49 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-05-14 15:45:48 -0700 |
commit | c01936a686ff75c872629b219898021e8ae49afa (patch) | |
tree | a3db17ffcdf0dbaad92275b841de0fd6619d2c16 | |
parent | bcf76242134317a2f722eab5af2600fe2858f895 (diff) | |
download | base-c01936a686ff75c872629b219898021e8ae49afa.tar.gz |
Add property for background GC type
To disable background compaction do:
adb shell setprop dalvik.vm.backgroundgctype CMS
To enable:
adb shell setprop dalvik.vm.backgroundgctype SS
Change-Id: I1d87b95fceaedac4df5ce6e718d7c14b35d524cc
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 362a54ec1a47..fc6cc81cc8ee 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -467,6 +467,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) char heapminfreeOptsBuf[sizeof("-XX:HeapMinFree=")-1 + PROPERTY_VALUE_MAX]; char heapmaxfreeOptsBuf[sizeof("-XX:HeapMaxFree=")-1 + PROPERTY_VALUE_MAX]; char gctypeOptsBuf[sizeof("-Xgc:")-1 + PROPERTY_VALUE_MAX]; + char backgroundgcOptsBuf[sizeof("-XX:BackgroundGC=")-1 + PROPERTY_VALUE_MAX]; char heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX]; char jitcodecachesizeOptsBuf[sizeof("-Xjitcodecachesize:")-1 + PROPERTY_VALUE_MAX]; char dalvikVmLibBuf[PROPERTY_VALUE_MAX]; @@ -620,6 +621,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) mOptions.add(opt); } + strcpy(backgroundgcOptsBuf, "-XX:BackgroundGC="); + property_get("dalvik.vm.backgroundgctype", backgroundgcOptsBuf+sizeof("-XX:BackgroundGC=")-1, ""); + if (backgroundgcOptsBuf[sizeof("-XX:BackgroundGC=")-1] != '\0') { + opt.optionString = backgroundgcOptsBuf; + mOptions.add(opt); + } + /* * Enable or disable dexopt features, such as bytecode verification and * calculation of register maps for precise GC. |