Use homogeneous space compaction for non low memory devices.
Saves nearly as much memory without needing the foreground
transition.
TODO: Pass in these flags from AndroidRuntime.cpp.
Bug: 16401001
Change-Id: Iecad0cc0c04fdf9cabe6f9d7f87c761a94b4142c
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 3ef7a17..27f7765 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -206,7 +206,7 @@
// If background_collector_type_ is kCollectorTypeNone, it defaults to the collector_type_ after
// parsing options. If you set this to kCollectorTypeHSpaceCompact then we will do an hspace
// compaction when we transition to background instead of a normal collector transition.
- background_collector_type_ = gc::kCollectorTypeSS;
+ background_collector_type_ = gc::kCollectorTypeHomogeneousSpaceCompact;
stack_size_ = 0; // 0 means default.
max_spins_before_thin_lock_inflation_ = Monitor::kDefaultMaxSpinsBeforeThinLockInflation;
low_memory_mode_ = false;
@@ -394,6 +394,10 @@
} else if (option == "-XX:IgnoreMaxFootprint") {
ignore_max_footprint_ = true;
} else if (option == "-XX:LowMemoryMode") {
+ if (background_collector_type_ == gc::kCollectorTypeHomogeneousSpaceCompact) {
+ // Use semispace instead of homogenous space compact for low memory mode.
+ background_collector_type_ = gc::kCollectorTypeSS;
+ }
low_memory_mode_ = true;
// TODO Might want to turn off must_relocate here.
} else if (option == "-XX:UseTLAB") {