node/test/parallel/test-performanceobserver-gc.js
James M Snell ea0154814a
perf_hooks: fix PerformanceObserver 'gc' crash
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: https://github.com/nodejs/node/issues/38412

PR-URL: https://github.com/nodejs/node/pull/38414
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-04-27 07:31:15 -07:00

18 lines
413 B
JavaScript

'use strict';
require('../common');
// Verifies that setting up two observers to listen
// to gc performance does not crash.
const {
PerformanceObserver,
} = require('perf_hooks');
// We don't actually care if the callback is ever invoked in this test
const obs = new PerformanceObserver(() => {});
const obs2 = new PerformanceObserver(() => {});
obs.observe({ type: 'gc' });
obs2.observe({ type: 'gc' });