mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
perf_hooks: avoid memory leak on gc observer
Fixes: https://github.com/nodejs/node/issues/22229 PR-URL: https://github.com/nodejs/node/pull/22241 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: George Adams <george.adams@uk.ibm.com>
This commit is contained in:
1 parent
1afcea107e
commit
f570c19c89
1 file changed
+3
@@ -272,6 +272,9 @@ void MarkGarbageCollectionEnd(Isolate* isolate,
|
||||
v8::GCCallbackFlags flags,
|
||||
void* data) {
|
||||
Environment* env = static_cast<Environment*>(data);
|
||||
// If no one is listening to gc performance entries, do not create them.
|
||||
if (!env->performance_state()->observers[NODE_PERFORMANCE_ENTRY_TYPE_GC])
|
||||
return;
|
||||
GCPerformanceEntry* entry =
|
||||
new GCPerformanceEntry(env,
|
||||
static_cast<PerformanceGCKind>(type),
|
||||
|
||||
Reference in new issue
Block a user