summaryrefslogtreecommitdiff
path: root/test/parallel/test-v8-getheapsnapshot-twice.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-10-12 14:24:44 +0200
committerAnna Henningsen <anna@addaleax.net>2020-10-14 20:11:51 +0200
commit62659511536f172946566347626a68e2b3b1c9d1 (patch)
treeb4055f8c25a618293fe639e0a75146ea21c09647 /test/parallel/test-v8-getheapsnapshot-twice.js
parent2707cc221adad8600a5086c79cdcf94c483f187e (diff)
downloadnode-new-62659511536f172946566347626a68e2b3b1c9d1.tar.gz
test: add regression test for v8.getHeapSnapshot() crash
Fixes: https://github.com/nodejs/node/issues/35559 PR-URL: https://github.com/nodejs/node/pull/35612 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Diffstat (limited to 'test/parallel/test-v8-getheapsnapshot-twice.js')
-rw-r--r--test/parallel/test-v8-getheapsnapshot-twice.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/parallel/test-v8-getheapsnapshot-twice.js b/test/parallel/test-v8-getheapsnapshot-twice.js
new file mode 100644
index 0000000000..feffd97aa0
--- /dev/null
+++ b/test/parallel/test-v8-getheapsnapshot-twice.js
@@ -0,0 +1,9 @@
+'use strict';
+require('../common');
+const v8 = require('v8');
+
+// Regression test for https://github.com/nodejs/node/issues/35559
+// It is important that the return value of the first call is not used, i.e.
+// that the first snapshot is GC-able while the second one is being created.
+v8.getHeapSnapshot();
+v8.getHeapSnapshot();