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:
parent
2eb78e6dc3
commit
f6eab1acf2
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user