aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-10-07 17:21:34 -0700
committerDavid 'Digit' Turner <digit@google.com>2009-10-07 17:21:34 -0700
commit03e124409bd08e620898fbaf8ce27dde3afa1143 (patch)
tree5502a1c8a91e14df594f5d50ba07635d47dd26af
parent2ec4559513cf475d499435444dffe8566c3aaaf3 (diff)
downloadexternal_qemu-03e124409bd08e620898fbaf8ce27dde3afa1143.zip
external_qemu-03e124409bd08e620898fbaf8ce27dde3afa1143.tar.gz
external_qemu-03e124409bd08e620898fbaf8ce27dde3afa1143.tar.bz2
Add a new hardware property: vm.heapSize
Allows to control the maximum heap size of Dalvik applications when running under emulation.
-rw-r--r--android/avd/hardware-properties.ini8
-rw-r--r--android/avd/hw-config-defs.h7
-rw-r--r--android/main.c8
3 files changed, 23 insertions, 0 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini
index 8744d64..b3e486b 100644
--- a/android/avd/hardware-properties.ini
+++ b/android/avd/hardware-properties.ini
@@ -154,3 +154,11 @@ type = integer
default = 160
abstract = Abstracted LCD density
description = Must be one of 120, 160 or 240. A value used to roughly describe the density of the LCD screen for automatic resource/asset selection.
+
+# Maximum VM heap size
+# Higher values are required for high-dpi devices
+name = vm.heapSize
+type = integer
+default = 16
+abstract = Max VM application heap size
+description = The maximum heap size a Dalvik application might allocate before being killed by the system. Value is in megabytes.
diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h
index b98f511..069ae23 100644
--- a/android/avd/hw-config-defs.h
+++ b/android/avd/hw-config-defs.h
@@ -157,6 +157,13 @@ HWCFG_INT(
"Abstracted LCD density",
"Must be one of 120, 160 or 240. A value used to roughly describe the density of the LCD screen for automatic resource/asset selection.")
+HWCFG_INT(
+ vm_heapSize,
+ "vm.heapSize",
+ 16,
+ "Max VM application heap size",
+ "The maximum heap size a Dalvik application might allocate before being killed by the system. Value is in megabytes.")
+
#undef HWCFG_INT
#undef HWCFG_BOOL
#undef HWCFG_DISKSIZE
diff --git a/android/main.c b/android/main.c
index ee1cbdb..6f73571 100644
--- a/android/main.c
+++ b/android/main.c
@@ -2638,6 +2638,14 @@ int main(int argc, char **argv)
hwLcd_setBootProperty(get_device_dpi(opts));
+ /* Set the VM's max heap size, passed as a boot property */
+ if (hw->vm_heapSize > 0) {
+ char tmp[32], *p=tmp, *end=p + sizeof(tmp);
+ p = bufprint(p, end, "%dm", hw->vm_heapSize);
+
+ boot_property_add("dalvik.vm.heapsize",tmp);
+ }
+
if (opts->prop != NULL) {
ParamList* pl = opts->prop;
for ( ; pl != NULL; pl = pl->next ) {