Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: src/heap.cc

Issue 165448: - Added simple memory reduction behavior for IdleNotification.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.h ('k') | src/spaces.h » ('j') | src/spaces.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 2676)
+++ src/heap.cc (working copy)
@@ -425,6 +425,20 @@
}
+void Heap::EnsureFromSpaceIsCommitted() {
+ if (new_space_.CommitFromSpaceIfNeeded()) return;
+
+ // Committing memory to from space failed.
+ // Try shrinking and try again.
+ Shrink();
+ if (new_space_.CommitFromSpaceIfNeeded()) return;
+
+ // Committing memory to from space failed again.
+ // Memory is exhausted and we will die.
+ V8::FatalProcessOutOfMemory("Committing semi space failed.");
+}
+
+
void Heap::PerformGarbageCollection(AllocationSpace space,
GarbageCollector collector,
GCTracer* tracer) {
@@ -433,7 +447,7 @@
ASSERT(!allocation_allowed_);
global_gc_prologue_callback_();
}
-
+ EnsureFromSpaceIsCommitted();
if (collector == MARK_COMPACTOR) {
MarkCompact(tracer);
« no previous file with comments | « src/heap.h ('k') | src/spaces.h » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698