Chromium Code Reviews| Index: src/spaces.cc |
| diff --git a/src/spaces.cc b/src/spaces.cc |
| index 583b2ca5124982cda6302c4b6b62213b34c2752a..d03707ec8adcc0ce1d91e1a8e144f24faa09f47c 100644 |
| --- a/src/spaces.cc |
| +++ b/src/spaces.cc |
| @@ -2390,10 +2390,14 @@ void PagedSpace::EvictEvacuationCandidatesFromFreeLists() { |
| HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) { |
| // Allocation in this space has failed. |
| - // If there are unswept pages advance lazy sweeper then sweep one page before |
| - // allocating a new page. |
| - if (first_unswept_page_->is_valid()) { |
| - AdvanceSweeper(size_in_bytes); |
| + // If there are unswept pages advance lazy sweeper a bounded number of times |
| + // until we find a size_in_bytes contiguous piece of memory |
|
Hannes Payer (out of office)
2012/11/15 13:08:46
there are so many heuristics all over the gc...
|
| + const int kMaxSweepingTries = 5; |
| + const int kAllocationSweepingFactor = 10; |
| + int i = 0; |
| + |
| + for (i = 0; i < kMaxSweepingTries && first_unswept_page_->is_valid(); i++) { |
| + AdvanceSweeper(size_in_bytes * kAllocationSweepingFactor); |
| // Retry the free list allocation. |
| HeapObject* object = free_list_.Allocate(size_in_bytes); |