forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf_hooks: fix PerformanceObserver gc crash
Signed-off-by: James M Snell <jasnell@gmail.com> Fixes: nodejs#39548
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
// Refers to https://github.com/nodejs/node/issues/39548 | ||
|
||
// The test fails if this crashes. If it closes normally, | ||
// then all is good. | ||
|
||
const { | ||
PerformanceObserver, | ||
} = require('perf_hooks'); | ||
|
||
// We don't actually care if the observer callback is called here. | ||
const gcObserver = new PerformanceObserver(() => {}); | ||
|
||
gcObserver.observe({ entryTypes: ['gc'] }); | ||
|
||
gcObserver.disconnect(); | ||
|
||
const gcObserver2 = new PerformanceObserver(() => {}); | ||
|
||
gcObserver2.observe({ entryTypes: ['gc'] }); | ||
|
||
gcObserver2.disconnect(); |