Hello v8-dev

I'm interested in assessing how close to the maximum heap size the old 
generation has expanded. Neither the HeapStatistics nor the newer 
HeapSpaceStatistics structures include this information (although 
HeapStatistics does provide heap_size_limit(), it provides a total 
reservation size that includes the young and old generation, and some extra 
space just for alignment). However, the information does appear to be 
readily available internally, but not exposed by the public API. I found I 
was able to make a few simple modifications to expose the information, but 
I would like some guidance / feedback on this with a view to getting this 
included in V8:

diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index 481cdd9..cf08882 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -4999,6 +4999,8 @@ class V8_EXPORT HeapStatistics {
   size_t total_available_size() { return total_available_size_; }
   size_t used_heap_size() { return used_heap_size_; }
   size_t heap_size_limit() { return heap_size_limit_; }
+  size_t max_semi_space_size() { return max_semi_space_size_; }
+  size_t max_old_space_size() { return max_old_space_size_; }
 
  private:
   size_t total_heap_size_;
@@ -5007,6 +5009,8 @@ class V8_EXPORT HeapStatistics {
   size_t total_available_size_;
   size_t used_heap_size_;
   size_t heap_size_limit_;
+  size_t max_semi_space_size_;
+  size_t max_old_space_size_;
 
   friend class V8;
   friend class Isolate;
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc
index a2feebe..23f5cc2 100644
--- a/deps/v8/src/api.cc
+++ b/deps/v8/src/api.cc
@@ -7230,6 +7230,8 @@ void Isolate::GetHeapStatistics(HeapStatistics* 
heap_statistics) {
   heap_statistics->total_available_size_ = heap->Available();
   heap_statistics->used_heap_size_ = heap->SizeOfObjects();
   heap_statistics->heap_size_limit_ = heap->MaxReserved();
+  heap_statistics->max_semi_space_size_ = heap->MaxSemiSpaceSize();
+  heap_statistics->max_old_space_size_ = heap->MaxOldGenerationSize();
 }


Would additions to the HeapStatistics structure such as this be acceptable?
In the event I missed it, is there another way to get this information that 
does not require modification of the V8 API?

Thanks!
Mike Tunnicliffe (IBM)

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to