Revision: 6266
Author: [email protected]
Date: Tue Jan 11 04:36:09 2011
Log: Add reporting of JS heap size limit to GetHeapStatistics.
I found it useful to know inside the heap profiler to avoid
crashes due to heap overflow.
Review URL: http://codereview.chromium.org/6111007
http://code.google.com/p/v8/source/detail?r=6266
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Tue Jan 4 01:27:46 2011
+++ /branches/bleeding_edge/include/v8.h Tue Jan 11 04:36:09 2011
@@ -2515,6 +2515,7 @@
size_t total_heap_size() { return total_heap_size_; }
size_t total_heap_size_executable() { return
total_heap_size_executable_; }
size_t used_heap_size() { return used_heap_size_; }
+ size_t heap_size_limit() { return heap_size_limit_; }
private:
void set_total_heap_size(size_t size) { total_heap_size_ = size; }
@@ -2522,10 +2523,12 @@
total_heap_size_executable_ = size;
}
void set_used_heap_size(size_t size) { used_heap_size_ = size; }
+ void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
size_t total_heap_size_;
size_t total_heap_size_executable_;
size_t used_heap_size_;
+ size_t heap_size_limit_;
friend class V8;
};
=======================================
--- /branches/bleeding_edge/src/api.cc Fri Dec 17 04:45:27 2010
+++ /branches/bleeding_edge/src/api.cc Tue Jan 11 04:36:09 2011
@@ -3299,7 +3299,8 @@
HeapStatistics::HeapStatistics(): total_heap_size_(0),
total_heap_size_executable_(0),
- used_heap_size_(0) { }
+ used_heap_size_(0),
+ heap_size_limit_(0) { }
void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
@@ -3307,6 +3308,7 @@
heap_statistics->set_total_heap_size_executable(
i::Heap::CommittedMemoryExecutable());
heap_statistics->set_used_heap_size(i::Heap::SizeOfObjects());
+ heap_statistics->set_heap_size_limit(i::Heap::MaxReserved());
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev