Commit b1bcf666 authored by hpayer's avatar hpayer Committed by Commit bot

Try to reduce memory footprint when we run out of memory in Deserializer.

BUG=403113
LOG=n

Review URL: https://codereview.chromium.org/831893003

Cr-Commit-Position: refs/heads/master@{#26010}
parent 7e98658e
......@@ -922,15 +922,6 @@ static void VerifyStringTable(Heap* heap) {
#endif // VERIFY_HEAP
static bool AbortIncrementalMarkingAndCollectGarbage(
Heap* heap, AllocationSpace space, const char* gc_reason = NULL) {
heap->mark_compact_collector()->SetFlags(Heap::kAbortIncrementalMarkingMask);
bool result = heap->CollectGarbage(space, gc_reason);
heap->mark_compact_collector()->SetFlags(Heap::kNoGCFlags);
return result;
}
bool Heap::ReserveSpace(Reservation* reservations) {
bool gc_performed = true;
int counter = 0;
......@@ -972,12 +963,18 @@ bool Heap::ReserveSpace(Reservation* reservations) {
}
if (perform_gc) {
if (space == NEW_SPACE) {
Heap::CollectGarbage(NEW_SPACE,
"failed to reserve space in the new space");
CollectGarbage(NEW_SPACE, "failed to reserve space in the new space");
} else {
AbortIncrementalMarkingAndCollectGarbage(
this, static_cast<AllocationSpace>(space),
"failed to reserve space in paged or large object space");
if (counter > 1) {
CollectAllGarbage(
kReduceMemoryFootprintMask,
"failed to reserve space in paged or large "
"object space, trying to reduce memory footprint");
} else {
CollectAllGarbage(
kAbortIncrementalMarkingMask,
"failed to reserve space in paged or large object space");
}
}
gc_performed = true;
break; // Abort for-loop over spaces and retry.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment