File tree 4 files changed +27
-3
lines changed
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:
22
22
* ` total_available_size ` {number}
23
23
* ` used_heap_size ` {number}
24
24
* ` 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.
25
34
26
35
For example:
27
36
@@ -32,7 +41,10 @@ For example:
32
41
total_physical_size: 7326976 ,
33
42
total_available_size: 1152656 ,
34
43
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
36
48
}
37
49
```
38
50
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ const kTotalPhysicalSizeIndex = v8binding.kTotalPhysicalSizeIndex;
25
25
const kTotalAvailableSize = v8binding . kTotalAvailableSize ;
26
26
const kUsedHeapSizeIndex = v8binding . kUsedHeapSizeIndex ;
27
27
const kHeapSizeLimitIndex = v8binding . kHeapSizeLimitIndex ;
28
+ const kDoesZapGarbageIndex = v8binding . kDoesZapGarbageIndex ;
29
+ const kMallocedMemoryIndex = v8binding . kMallocedMemoryIndex ;
30
+ const kPeakMallocedMemoryIndex = v8binding . kPeakMallocedMemoryIndex ;
28
31
29
32
// Properties for heap space statistics buffer extraction.
30
33
const heapSpaceStatisticsBuffer =
@@ -49,7 +52,10 @@ exports.getHeapStatistics = function() {
49
52
'total_physical_size' : buffer [ kTotalPhysicalSizeIndex ] ,
50
53
'total_available_size' : buffer [ kTotalAvailableSize ] ,
51
54
'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 ]
53
59
} ;
54
60
} ;
55
61
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ using v8::Value;
28
28
V (2 , total_physical_size, kTotalPhysicalSizeIndex ) \
29
29
V (3 , total_available_size, kTotalAvailableSize ) \
30
30
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 )
32
35
33
36
#define V (a, b, c ) +1
34
37
static const size_t kHeapStatisticsPropertiesCount =
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ var v8 = require('v8');
5
5
6
6
var s = v8 . getHeapStatistics ( ) ;
7
7
var keys = [
8
+ 'does_zap_garbage' ,
8
9
'heap_size_limit' ,
10
+ 'malloced_memory' ,
11
+ 'peak_malloced_memory' ,
9
12
'total_available_size' ,
10
13
'total_heap_size' ,
11
14
'total_heap_size_executable' ,
You can’t perform that action at this time.
0 commit comments