Skip to content

Commit 0a1352a

Browse files
ssiddharthaCommit bot
authored andcommitted
Extending v8::GetHeapStatistics to return total available size.
For dumping memory statistics about v8 heap, we need the total available size of the heap. This CL adds extra field in HeapStatistics to return the available size. BUG=476013 LOG=Y Review URL: https://codereview.chromium.org/1104123002 Cr-Commit-Position: refs/heads/master@{#28100}
1 parent 12350f1 commit 0a1352a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

include/v8.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4776,13 +4776,15 @@ class V8_EXPORT HeapStatistics {
47764776
size_t total_heap_size() { return total_heap_size_; }
47774777
size_t total_heap_size_executable() { return total_heap_size_executable_; }
47784778
size_t total_physical_size() { return total_physical_size_; }
4779+
size_t total_available_size() { return total_available_size_; }
47794780
size_t used_heap_size() { return used_heap_size_; }
47804781
size_t heap_size_limit() { return heap_size_limit_; }
47814782

47824783
private:
47834784
size_t total_heap_size_;
47844785
size_t total_heap_size_executable_;
47854786
size_t total_physical_size_;
4787+
size_t total_available_size_;
47864788
size_t used_heap_size_;
47874789
size_t heap_size_limit_;
47884790

src/api.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6871,6 +6871,7 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
68716871
heap_statistics->total_heap_size_executable_ =
68726872
heap->CommittedMemoryExecutable();
68736873
heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
6874+
heap_statistics->total_available_size_ = heap->Available();
68746875
heap_statistics->used_heap_size_ = heap->SizeOfObjects();
68756876
heap_statistics->heap_size_limit_ = heap->MaxReserved();
68766877
}

0 commit comments

Comments
 (0)