Implement ClampGrowthLimit feature for region space
Concurrent copying GC, which uses region space, needs
virtual heap to be twice of capacity. Hence, it
becomes an issue with 32-bit apps which need large native heap.
Bug: 72383501
Bug: 72297706
Test: test-art-target
Change-Id: I7a8f272e82b3eb15a5dc57cfbfd51b7d62aa141f
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index cf5bd4a..84671c3 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3525,6 +3525,11 @@
malloc_space->ClampGrowthLimit();
}
}
+ if (collector_type_ == kCollectorTypeCC) {
+ DCHECK(region_space_ != nullptr);
+ // Twice the capacity as CC needs extra space for evacuating objects.
+ region_space_->ClampGrowthLimit(2 * capacity_);
+ }
// This space isn't added for performance reasons.
if (main_space_backup_.get() != nullptr) {
main_space_backup_->ClampGrowthLimit();