| Index: src/spaces.cc
|
| diff --git a/src/spaces.cc b/src/spaces.cc
|
| index 583b2ca5124982cda6302c4b6b62213b34c2752a..8cfaa7bbb64e8afb74690bf08ec524f245903474 100644
|
| --- a/src/spaces.cc
|
| +++ b/src/spaces.cc
|
| @@ -2390,9 +2390,12 @@ 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()) {
|
| + // If there are unswept pages advance lazy sweeper a bounded number of times
|
| + // until we find a size_in_bytes contiguous piece of memory
|
| + const int kMaxSweepingTries = 5;
|
| + int i = 0;
|
| +
|
| + for (i = 0; i < kMaxSweepingTries && first_unswept_page_->is_valid(); i++) {
|
| AdvanceSweeper(size_in_bytes);
|
|
|
| // Retry the free list allocation.
|
|
|