summaryrefslogtreecommitdiff
path: root/lib/v8.js
diff options
context:
space:
mode:
authorGareth Ellis <gareth.ellis@uk.ibm.com>2016-09-17 10:52:26 +0100
committerAnna Henningsen <anna@addaleax.net>2016-11-20 02:23:00 +0100
commit440057eae048821fb8ae11313663de4fcced2cfd (patch)
treea645382f6a4728830647ad2b82bf32e4c6079911 /lib/v8.js
parent31dac410a43455a6facbf2a573bcd792a63ba0ca (diff)
downloadnode-new-440057eae048821fb8ae11313663de4fcced2cfd.tar.gz
src: extend `HeapStatistics` with new fields
src: Add does_zap_garbage, malloced_memory and peak_malloced_memory to v8 HeapStatistics Following https://github.com/nodejs/code-and-learn/issues/56 I have exposed does_zap_garbage to HeapStatistics. The other fields, malloced_memory and peak_malloced_memory don't seem to be in the current version of v8 in master. PR-URL: https://github.com/nodejs/node/pull/8610 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/v8.js')
-rw-r--r--lib/v8.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/v8.js b/lib/v8.js
index e78a2480ff..90abc627a4 100644
--- a/lib/v8.js
+++ b/lib/v8.js
@@ -25,6 +25,9 @@ const kTotalPhysicalSizeIndex = v8binding.kTotalPhysicalSizeIndex;
const kTotalAvailableSize = v8binding.kTotalAvailableSize;
const kUsedHeapSizeIndex = v8binding.kUsedHeapSizeIndex;
const kHeapSizeLimitIndex = v8binding.kHeapSizeLimitIndex;
+const kDoesZapGarbageIndex = v8binding.kDoesZapGarbageIndex;
+const kMallocedMemoryIndex = v8binding.kMallocedMemoryIndex;
+const kPeakMallocedMemoryIndex = v8binding.kPeakMallocedMemoryIndex;
// Properties for heap space statistics buffer extraction.
const heapSpaceStatisticsBuffer =
@@ -49,7 +52,10 @@ exports.getHeapStatistics = function() {
'total_physical_size': buffer[kTotalPhysicalSizeIndex],
'total_available_size': buffer[kTotalAvailableSize],
'used_heap_size': buffer[kUsedHeapSizeIndex],
- 'heap_size_limit': buffer[kHeapSizeLimitIndex]
+ 'heap_size_limit': buffer[kHeapSizeLimitIndex],
+ 'malloced_memory': buffer[kMallocedMemoryIndex],
+ 'peak_malloced_memory': buffer[kPeakMallocedMemoryIndex],
+ 'does_zap_garbage': buffer[kDoesZapGarbageIndex]
};
};