Enable the hspace compaction on OOM by default.
(cherrypick commit d3f228062a1d71ce6ace2f31ecf369ae247633c2)
Bug: 18377775
Change-Id: I4a0998c7f35b6418004e92bc07926abc9b74962a
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 0e67978..3f747ee 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -232,9 +232,13 @@
+-main alloc space2 / bump space 2 (capacity_)+-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
*/
+ // We don't have hspace compaction enabled with GSS.
+ if (foreground_collector_type_ == kCollectorTypeGSS) {
+ use_homogeneous_space_compaction_for_oom_ = false;
+ }
bool support_homogeneous_space_compaction =
background_collector_type_ == gc::kCollectorTypeHomogeneousSpaceCompact ||
- use_homogeneous_space_compaction_for_oom;
+ use_homogeneous_space_compaction_for_oom_;
// We may use the same space the main space for the non moving space if we don't need to compact
// from the main space.
// This is not the case if we support homogeneous compaction or have a moving background
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 1a97c35..3e6c86b 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -105,11 +105,7 @@
profile_clock_source_(kDefaultTraceClockSource),
verify_(true),
image_isa_(kRuntimeISA),
- use_homogeneous_space_compaction_for_oom_(false), // If we are using homogeneous space
- // compaction then default background
- // compaction to off since homogeneous
- // space compactions when we transition
- // to not jank perceptible.
+ use_homogeneous_space_compaction_for_oom_(true), // Enable hspace compaction on OOM by default.
min_interval_homogeneous_space_compaction_by_oom_(MsToNs(100 * 1000)) // 100s.
{}