Skip to content

Commit a8a7e71

Browse files
captain5050Android (Google) Code Review
authored andcommitted
Merge "Extra GC heap configuration parameters." into jb-mr1-dev
2 parents 5e21bf9 + 5325010 commit a8a7e71

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

core/jni/AndroidRuntime.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
453453
char heapstartsizeOptsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX];
454454
char heapsizeOptsBuf[sizeof("-Xmx")-1 + PROPERTY_VALUE_MAX];
455455
char heapgrowthlimitOptsBuf[sizeof("-XX:HeapGrowthLimit=")-1 + PROPERTY_VALUE_MAX];
456+
char heapminfreeOptsBuf[sizeof("-XX:HeapMinFree=")-1 + PROPERTY_VALUE_MAX];
457+
char heapmaxfreeOptsBuf[sizeof("-XX:HeapMaxFree=")-1 + PROPERTY_VALUE_MAX];
458+
char heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX];
456459
char extraOptsBuf[PROPERTY_VALUE_MAX];
457460
char* stackTraceFile = NULL;
458461
bool checkJni = false;
@@ -555,6 +558,27 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
555558
mOptions.add(opt);
556559
}
557560

561+
strcpy(heapminfreeOptsBuf, "-XX:HeapMinFree=");
562+
property_get("dalvik.vm.heapminfree", heapminfreeOptsBuf+16, "");
563+
if (heapminfreeOptsBuf[16] != '\0') {
564+
opt.optionString = heapminfreeOptsBuf;
565+
mOptions.add(opt);
566+
}
567+
568+
strcpy(heapmaxfreeOptsBuf, "-XX:HeapMaxFree=");
569+
property_get("dalvik.vm.heapmaxfree", heapmaxfreeOptsBuf+16, "");
570+
if (heapmaxfreeOptsBuf[16] != '\0') {
571+
opt.optionString = heapmaxfreeOptsBuf;
572+
mOptions.add(opt);
573+
}
574+
575+
strcpy(heaptargetutilizationOptsBuf, "-XX:HeapTargetUtilization=");
576+
property_get("dalvik.vm.heaptargetutilization", heaptargetutilizationOptsBuf+26, "");
577+
if (heapmaxfreeOptsBuf[26] != '\0') {
578+
opt.optionString = heaptargetutilizationOptsBuf;
579+
mOptions.add(opt);
580+
}
581+
558582
/*
559583
* Enable or disable dexopt features, such as bytecode verification and
560584
* calculation of register maps for precise GC.

0 commit comments

Comments
 (0)