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

Unified Diff: src/heap/spaces.cc

Issue 1024823002: Fix OOM bug 3976. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix signed/unsigned comparison Created 5 years, 9 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/spaces.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 827f3abb607a9ec7e8a82d58de548bd3e83c37e8..6c2b58b17e5795995911aa6a992226ce8050ef18 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1019,7 +1019,8 @@ bool PagedSpace::CanExpand() {
DCHECK(max_capacity_ % AreaSize() == 0);
DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
DCHECK(heap()->CommittedOldGenerationMemory() <=
- heap()->MaxOldGenerationSize());
+ heap()->MaxOldGenerationSize() +
+ PagedSpace::MaxEmergencyMemoryAllocated());
// Are we going to exceed capacity for this space?
if (!heap()->CanExpandOldGeneration(Page::kPageSize)) return false;
@@ -1046,7 +1047,8 @@ bool PagedSpace::Expand() {
DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
DCHECK(heap()->CommittedOldGenerationMemory() <=
- heap()->MaxOldGenerationSize());
+ heap()->MaxOldGenerationSize() +
+ PagedSpace::MaxEmergencyMemoryAllocated());
p->InsertAfter(anchor_.prev_page());
@@ -1128,6 +1130,15 @@ void PagedSpace::ReleasePage(Page* page) {
}
+intptr_t PagedSpace::MaxEmergencyMemoryAllocated() {
+ // New space and large object space.
+ static const int spaces_without_emergency_memory = 2;
+ static const int spaces_with_emergency_memory =
+ LAST_SPACE - FIRST_SPACE + 1 - spaces_without_emergency_memory;
+ return Page::kPageSize * spaces_with_emergency_memory;
+}
+
+
void PagedSpace::CreateEmergencyMemory() {
if (identity() == CODE_SPACE) {
// Make the emergency block available to the allocator.
« no previous file with comments | « src/heap/spaces.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698