From 775af7af4f8089e6f2c54ac7ebd478cca92715a0 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 12 Oct 2020 14:24:44 +0200 Subject: [PATCH] test: add regression test for v8.getHeapSnapshot() crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/nodejs/node/issues/35559 PR-URL: https://github.com/nodejs/node/pull/35612 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil Reviewed-By: Gerhard Stöbich --- test/parallel/test-v8-getheapsnapshot-twice.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/parallel/test-v8-getheapsnapshot-twice.js diff --git a/test/parallel/test-v8-getheapsnapshot-twice.js b/test/parallel/test-v8-getheapsnapshot-twice.js new file mode 100644 index 00000000000000..feffd97aa001a3 --- /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();