@@ -32,6 +32,26 @@ v8.setFlagsFromString('--allow_natives_syntax'); |
32 | 32 | console.log(v8.cachedDataVersionTag()); // 183726201 |
33 | 33 | ``` |
34 | 34 |
|
| 35 | +## `v8.getHeapSnapshot()` |
| 36 | +<!-- YAML |
| 37 | +added: v11.13.0 |
| 38 | +--> |
| 39 | + |
| 40 | +* Returns: {stream.Readable} A Readable Stream containing the V8 heap snapshot |
| 41 | + |
| 42 | +Generates a snapshot of the current V8 heap and returns a Readable |
| 43 | +Stream that may be used to read the JSON serialized representation. |
| 44 | +This JSON stream format is intended to be used with tools such as |
| 45 | +Chrome DevTools. The JSON schema is undocumented and specific to the |
| 46 | +V8 engine. Therefore, the schema may change from one version of V8 to the next. |
| 47 | + |
| 48 | +```js |
| 49 | +// Print heap snapshot to the console |
| 50 | +const v8 = require('v8'); |
| 51 | +const stream = v8.getHeapSnapshot(); |
| 52 | +stream.pipe(process.stdout); |
| 53 | +``` |
| 54 | + |
35 | 55 | ## `v8.getHeapSpaceStatistics()` |
36 | 56 | <!-- YAML |
37 | 57 | added: v6.0.0 |
@@ -97,26 +117,6 @@ The value returned is an array of objects containing the following properties: |
97 | 117 | ] |
98 | 118 | ``` |
99 | 119 |
|
100 | | -## `v8.getHeapSnapshot()` |
101 | | -<!-- YAML |
102 | | -added: v11.13.0 |
103 | | ---> |
104 | | - |
105 | | -* Returns: {stream.Readable} A Readable Stream containing the V8 heap snapshot |
106 | | - |
107 | | -Generates a snapshot of the current V8 heap and returns a Readable |
108 | | -Stream that may be used to read the JSON serialized representation. |
109 | | -This JSON stream format is intended to be used with tools such as |
110 | | -Chrome DevTools. The JSON schema is undocumented and specific to the |
111 | | -V8 engine, and may change from one version of V8 to the next. |
112 | | - |
113 | | -```js |
114 | | -// Print heap snapshot to the console |
115 | | -const v8 = require('v8'); |
116 | | -const stream = v8.getHeapSnapshot(); |
117 | | -stream.pipe(process.stdout); |
118 | | -``` |
119 | | - |
120 | 120 | ## `v8.getHeapStatistics()` |
121 | 121 | <!-- YAML |
122 | 122 | added: v1.0.0 |
|