Skip to content

Commit 01129a7

Browse files
Trottdanielleadams
authored andcommitted
doc: revise v8.getHeapSnapshot()
* move entry above v8.getHeapSpaceStatistics() (where it belongs alphabetically and is not out of place logically) * split lengthy sentence into two sentences PR-URL: #35849 Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 77d33c9 commit 01129a7

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

doc/api/v8.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ v8.setFlagsFromString('--allow_natives_syntax');
3232
console.log(v8.cachedDataVersionTag()); // 183726201
3333
```
3434

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+
3555
## `v8.getHeapSpaceStatistics()`
3656
<!-- YAML
3757
added: v6.0.0
@@ -97,26 +117,6 @@ The value returned is an array of objects containing the following properties:
97117
]
98118
```
99119

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-
120120
## `v8.getHeapStatistics()`
121121
<!-- YAML
122122
added: v1.0.0

0 commit comments

Comments
 (0)