From 7e4fdec6f0ac6385c5f8aeaf0f2e12e162138ac3 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 2 Dec 2013 15:46:51 -0800 Subject: Add dalvik.vm.gctype to enable switching between different GCs. The option passes the specified GC type into the Xgc runtime option. Currently the three different supported GC types are MS, CMS, SS which represent mark-sweep, concurrent mark-sweep, mark-sweep + semi-space hybrid. Change-Id: I6ad95c8d12c0d1158f7c861ff0c3180761619172 --- core/jni/AndroidRuntime.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/jni/AndroidRuntime.cpp') diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 8518101..2de308a 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -448,6 +448,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) char heapgrowthlimitOptsBuf[sizeof("-XX:HeapGrowthLimit=")-1 + PROPERTY_VALUE_MAX]; 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 heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX]; char jitcodecachesizeOptsBuf[sizeof("-Xjitcodecachesize:")-1 + PROPERTY_VALUE_MAX]; char extraOptsBuf[PROPERTY_VALUE_MAX]; @@ -583,6 +584,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) mOptions.add(opt); } + strcpy(gctypeOptsBuf, "-Xgc:"); + property_get("dalvik.vm.gctype", gctypeOptsBuf+5, ""); + if (gctypeOptsBuf[5] != '\0') { + opt.optionString = gctypeOptsBuf; + mOptions.add(opt); + } + /* * Enable or disable dexopt features, such as bytecode verification and * calculation of register maps for precise GC. -- cgit v1.1