summaryrefslogtreecommitdiffstats
path: root/vm/Init.c
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2011-01-18 17:59:30 -0800
committerCarl Shapiro <cshapiro@google.com>2011-01-18 17:59:30 -0800
commitdf9f08b877ecfd8ebadea822bb9e066ee7d30433 (patch)
tree2ace664586d3f29a5183e6f71e2f8138c69cb83a /vm/Init.c
parent241cec80a79551730122fb9dbc92a3527392b1de (diff)
downloadandroid_dalvik-df9f08b877ecfd8ebadea822bb9e066ee7d30433.tar.gz
android_dalvik-df9f08b877ecfd8ebadea822bb9e066ee7d30433.tar.bz2
android_dalvik-df9f08b877ecfd8ebadea822bb9e066ee7d30433.zip
Implement growth limits to support multiple heap configurations.
When a growth limit is in effect, allocations will be limited to number of bytes specified by the growth limit instead of the maximum heap size. Growth limits are specified on the command line with the new parameter -XX:HeapGrowthLimit. A growth limit can be removed at runtime by calling the new clearGrowthLimit method. This is a work around until we can adjust the maximum heap size at runtime. Change-Id: Ic01e32823b5ca8cf29c0948fb6cd2df10967c1fb
Diffstat (limited to 'vm/Init.c')
-rw-r--r--vm/Init.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/vm/Init.c b/vm/Init.c
index ae609c6b8..9fcd2914e 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -769,7 +769,7 @@ static int processOptions(int argc, const char* const argv[],
size_t val = parseMemOption(argv[i]+4, 1024);
if (val != 0) {
if (val >= kMinHeapStartSize && val <= kMaxHeapSize) {
- gDvm.heapSizeStart = val;
+ gDvm.heapStartingSize = val;
} else {
dvmFprintf(stderr,
"Invalid -Xms '%s', range is %dKB to %dKB\n",
@@ -784,7 +784,7 @@ static int processOptions(int argc, const char* const argv[],
size_t val = parseMemOption(argv[i]+4, 1024);
if (val != 0) {
if (val >= kMinHeapSize && val <= kMaxHeapSize) {
- gDvm.heapSizeMax = val;
+ gDvm.heapMaximumSize = val;
} else {
dvmFprintf(stderr,
"Invalid -Xmx '%s', range is %dKB to %dKB\n",
@@ -795,6 +795,14 @@ static int processOptions(int argc, const char* const argv[],
dvmFprintf(stderr, "Invalid -Xmx option '%s'\n", argv[i]);
return -1;
}
+ } else if (strncmp(argv[i], "-XX:HeapGrowthLimit=", 20) == 0) {
+ size_t val = parseMemOption(argv[i] + 20, 1024);
+ if (val != 0) {
+ gDvm.heapGrowthLimit = val;
+ } else {
+ dvmFprintf(stderr, "Invalid -XX:HeapGrowthLimit option '%s'\n", argv[i]);
+ return -1;
+ }
} else if (strncmp(argv[i], "-Xss", 4) == 0) {
size_t val = parseMemOption(argv[i]+4, 1);
if (val != 0) {
@@ -1057,8 +1065,9 @@ static void setCommandLineDefaults()
/* Defaults overridden by -Xms and -Xmx.
* TODO: base these on a system or application-specific default
*/
- gDvm.heapSizeStart = 2 * 1024 * 1024; // Spec says 16MB; too big for us.
- gDvm.heapSizeMax = 16 * 1024 * 1024; // Spec says 75% physical mem
+ gDvm.heapStartingSize = 2 * 1024 * 1024; // Spec says 16MB; too big for us.
+ gDvm.heapMaximumSize = 16 * 1024 * 1024; // Spec says 75% physical mem
+ gDvm.heapGrowthLimit = 0; // 0 means no growth limit
gDvm.stackSize = kDefaultStackSize;
gDvm.concurrentMarkSweep = true;