Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index f28d17a9b68fab830756085901e3308d53db4896..b4b019ef50d5481c6255a64cd56a19c4f6eebbe5 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -1325,7 +1325,8 @@ bool Heap::PerformGarbageCollection( |
// Register the amount of external allocated memory. |
amount_of_external_allocated_memory_at_last_global_gc_ = |
amount_of_external_allocated_memory_; |
- SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); |
+ SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed, |
+ freed_global_handles); |
} else if (HasLowYoungGenerationAllocationRate() && |
old_generation_size_configured_) { |
DampenOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); |
@@ -5653,7 +5654,11 @@ intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor, |
void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
double gc_speed, |
- double mutator_speed) { |
+ double mutator_speed, |
+ int freed_global_handles) { |
+ const int kFreedGlobalHandlesThreshold = 700; |
ulan
2015/07/30 13:58:32
These numbers are from the old heap growing strate
|
+ const double kMaxHeapGrowingFactorForManyFreedGlobalHandles = 1.3; |
+ |
double factor = HeapGrowingFactor(gc_speed, mutator_speed); |
if (FLAG_trace_gc_verbose) { |
@@ -5671,6 +5676,10 @@ void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained); |
} |
+ if (freed_global_handles >= kFreedGlobalHandlesThreshold) { |
+ factor = Min(factor, kMaxHeapGrowingFactorForManyFreedGlobalHandles); |
+ } |
+ |
if (FLAG_stress_compaction || |
mark_compact_collector()->reduce_memory_footprint_) { |
factor = kMinHeapGrowingFactor; |