summaryrefslogtreecommitdiff
path: root/lib/internal/test
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2019-03-07 16:51:36 +0000
committerJames M Snell <jasnell@gmail.com>2019-03-13 15:50:32 +0000
commit5f38797ea51886708fbde22527fc54e64382925c (patch)
tree23d3fe878077b09d7cfe502c48fd9e2a03f35800 /lib/internal/test
parent024842f8f4f139a4af310976e7f78dff51f12654 (diff)
downloadandroid-node-v8-5f38797ea51886708fbde22527fc54e64382925c.tar.gz
android-node-v8-5f38797ea51886708fbde22527fc54e64382925c.tar.bz2
android-node-v8-5f38797ea51886708fbde22527fc54e64382925c.zip
v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted from the `node-heapdump` module. Also, adds a v8.getHeapSnapshot() alternative that returns a Readable Stream PR-URL: https://github.com/nodejs/node/pull/26501 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/internal/test')
-rw-r--r--lib/internal/test/heap.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/internal/test/heap.js b/lib/internal/test/heap.js
index 52e00b9da5..6565e8fbd8 100644
--- a/lib/internal/test/heap.js
+++ b/lib/internal/test/heap.js
@@ -4,14 +4,17 @@ process.emitWarning(
'These APIs are for internal testing only. Do not use them.',
'internal/test/heap');
-const { createHeapDump, buildEmbedderGraph } = internalBinding('heap_utils');
+const {
+ createHeapSnapshot,
+ buildEmbedderGraph
+} = internalBinding('heap_utils');
const assert = require('internal/assert');
// This is not suitable for production code. It creates a full V8 heap dump,
// parses it as JSON, and then creates complex objects from it, leading
// to significantly increased memory usage.
-function createJSHeapDump() {
- const dump = createHeapDump();
+function createJSHeapSnapshot() {
+ const dump = createHeapSnapshot();
const meta = dump.snapshot.meta;
const nodes =
@@ -81,6 +84,6 @@ function readHeapInfo(raw, fields, types, strings) {
}
module.exports = {
- createJSHeapDump,
+ createJSHeapSnapshot,
buildEmbedderGraph
};