File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ Returns an object with the following properties:
2222* ` total_available_size ` {number}
2323* ` used_heap_size ` {number}
2424* ` heap_size_limit ` {number}
25+ * ` malloced_memory ` {number}
26+ * ` peak_malloced_memory ` {number}
27+ * ` does_zap_garbage ` {number}
28+
29+ ` does_zap_garbage ` is a 0/1 boolean, which signifies whether the ` --zap_code_space `
30+ option is enabled or not. This makes V8 overwrite heap garbage with a bit
31+ pattern. The RSS footprint (resident memory set) gets bigger because it
32+ continuously touches all heap pages and that makes them less likely to get
33+ swapped out by the operating system.
2534
2635For example:
2736
@@ -32,7 +41,10 @@ For example:
3241 total_physical_size: 7326976 ,
3342 total_available_size: 1152656 ,
3443 used_heap_size: 3476208 ,
35- heap_size_limit: 1535115264
44+ heap_size_limit: 1535115264 ,
45+ malloced_memory: 16384 ,
46+ peak_malloced_memory: 1127496 ,
47+ does_zap_garbage: 0
3648}
3749```
3850
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ const kTotalPhysicalSizeIndex = v8binding.kTotalPhysicalSizeIndex;
2525const kTotalAvailableSize = v8binding . kTotalAvailableSize ;
2626const kUsedHeapSizeIndex = v8binding . kUsedHeapSizeIndex ;
2727const kHeapSizeLimitIndex = v8binding . kHeapSizeLimitIndex ;
28+ const kDoesZapGarbageIndex = v8binding . kDoesZapGarbageIndex ;
29+ const kMallocedMemoryIndex = v8binding . kMallocedMemoryIndex ;
30+ const kPeakMallocedMemoryIndex = v8binding . kPeakMallocedMemoryIndex ;
2831
2932// Properties for heap space statistics buffer extraction.
3033const heapSpaceStatisticsBuffer =
@@ -49,7 +52,10 @@ exports.getHeapStatistics = function() {
4952 'total_physical_size' : buffer [ kTotalPhysicalSizeIndex ] ,
5053 'total_available_size' : buffer [ kTotalAvailableSize ] ,
5154 'used_heap_size' : buffer [ kUsedHeapSizeIndex ] ,
52- 'heap_size_limit' : buffer [ kHeapSizeLimitIndex ]
55+ 'heap_size_limit' : buffer [ kHeapSizeLimitIndex ] ,
56+ 'malloced_memory' : buffer [ kMallocedMemoryIndex ] ,
57+ 'peak_malloced_memory' : buffer [ kPeakMallocedMemoryIndex ] ,
58+ 'does_zap_garbage' : buffer [ kDoesZapGarbageIndex ]
5359 } ;
5460} ;
5561
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ using v8::Value;
2828 V (2 , total_physical_size, kTotalPhysicalSizeIndex ) \
2929 V (3 , total_available_size, kTotalAvailableSize ) \
3030 V (4 , used_heap_size, kUsedHeapSizeIndex ) \
31- V (5 , heap_size_limit, kHeapSizeLimitIndex )
31+ V (5 , heap_size_limit, kHeapSizeLimitIndex ) \
32+ V (6 , malloced_memory, kMallocedMemoryIndex ) \
33+ V (7 , peak_malloced_memory, kPeakMallocedMemoryIndex ) \
34+ V (8 , does_zap_garbage, kDoesZapGarbageIndex )
3235
3336#define V (a, b, c ) +1
3437static const size_t kHeapStatisticsPropertiesCount =
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ var v8 = require('v8');
55
66var s = v8 . getHeapStatistics ( ) ;
77var keys = [
8+ 'does_zap_garbage' ,
89 'heap_size_limit' ,
10+ 'malloced_memory' ,
11+ 'peak_malloced_memory' ,
912 'total_available_size' ,
1013 'total_heap_size' ,
1114 'total_heap_size_executable' ,
You can’t perform that action at this time.
0 commit comments