perf_hooks: fix PerformanceObserver observer count leaks · nodejs/node@0bd9905 · GitHub
Skip to content

Commit 0bd9905

Browse files
jasnelladuh95
authored andcommitted
perf_hooks: fix PerformanceObserver observer count leaks
Observing the same entry type more than once on a PerformanceObserver, through repeated `observe({ type })` calls or duplicates in `entryTypes`, incremented the internal observer count each time, while `disconnect()` decremented it only once per observed type. The counts never returned to zero, so GC tracking stayed installed, and entries for types such as `'http'` and `'dns'` kept being created after all observers had disconnected. Count each entry type at most once per observer. Assisted-by: OpenCode Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #66097 Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 13dbf19 commit 0bd9905

2 files changed

Lines changed: 99 additions & 5 deletions

File tree

‎lib/internal/perf/observe.js‎

Lines changed: 12 additions & 5 deletions
Lines changed: 87 additions & 0 deletions

0 commit comments

Comments
 (0)