| Index: src/spaces.cc
|
| diff --git a/src/spaces.cc b/src/spaces.cc
|
| index 0ac23d279db6d5c13e3d9b0b67206cdd7f983ce0..cacd9691501c10428a7a2b97d3a810cfd683789a 100644
|
| --- a/src/spaces.cc
|
| +++ b/src/spaces.cc
|
| @@ -2391,10 +2391,13 @@ 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
|
| + const int kMaxSweepingTries = 5;
|
| + bool sweeping_complete = false;
|
| +
|
| + for (int i = 0; i < kMaxSweepingTries && !sweeping_complete; i++) {
|
| + sweeping_complete = AdvanceSweeper(size_in_bytes);
|
|
|
| // Retry the free list allocation.
|
| HeapObject* object = free_list_.Allocate(size_in_bytes);
|
|
|