Revision: 9695
Author: [email protected]
Date: Wed Oct 19 03:15:09 2011
Log: Don't allow large object space to grow over the max oldspace
limit (fixes issue 1717)
Review URL: http://codereview.chromium.org/8345040
http://code.google.com/p/v8/source/detail?r=9695
Modified:
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/src/spaces.h
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Oct 17 05:44:16 2011
+++ /branches/bleeding_edge/src/heap.cc Wed Oct 19 03:15:09 2011
@@ -5450,7 +5450,7 @@
// The large object code space may contain code or data. We set the
memory
// to be non-executable here for safety, but this means we need to
enable it
// explicitly when allocating large code objects.
- lo_space_ = new LargeObjectSpace(this, LO_SPACE);
+ lo_space_ = new LargeObjectSpace(this, max_old_generation_size_,
LO_SPACE);
if (lo_space_ == NULL) return false;
if (!lo_space_->Setup()) return false;
if (create_heap_objects) {
=======================================
--- /branches/bleeding_edge/src/spaces.cc Fri Oct 14 03:52:30 2011
+++ /branches/bleeding_edge/src/spaces.cc Wed Oct 19 03:15:09 2011
@@ -2291,8 +2291,11 @@
//
-----------------------------------------------------------------------------
// LargeObjectSpace
-LargeObjectSpace::LargeObjectSpace(Heap* heap, AllocationSpace id)
+LargeObjectSpace::LargeObjectSpace(Heap* heap,
+ intptr_t max_capacity,
+ AllocationSpace id)
: Space(heap, id, NOT_EXECUTABLE), // Managed on a per-allocation
basis
+ max_capacity_(max_capacity),
first_page_(NULL),
size_(0),
page_count_(0),
@@ -2331,6 +2334,10 @@
heap()->OldGenerationAllocationLimitReached()) {
return Failure::RetryAfterGC(identity());
}
+
+ if (Size() + object_size > max_capacity_) {
+ return Failure::RetryAfterGC(identity());
+ }
LargePage* page = heap()->isolate()->memory_allocator()->
AllocateLargePage(object_size, executable, this);
=======================================
--- /branches/bleeding_edge/src/spaces.h Fri Oct 14 02:25:10 2011
+++ /branches/bleeding_edge/src/spaces.h Wed Oct 19 03:15:09 2011
@@ -2442,7 +2442,7 @@
class LargeObjectSpace : public Space {
public:
- LargeObjectSpace(Heap* heap, AllocationSpace id);
+ LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id);
virtual ~LargeObjectSpace() {}
// Initializes internal data structures.
@@ -2512,6 +2512,7 @@
bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure();
}
private:
+ intptr_t max_capacity_;
// The head of the linked list of large object chunks.
LargePage* first_page_;
intptr_t size_; // allocated bytes
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev