Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc38b20

Browse filesBrowse files
committed
perf_hooks: clean up GC listeners
Add Environment cleanup hooks to remove GC listeners when the `Environment` is torn down. PR-URL: #25647 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 845bcfa commit fc38b20
Copy full SHA for fc38b20

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Collapse file

‎src/node_perf.cc‎

Copy file name to clipboardExpand all lines: src/node_perf.cc
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ inline void SetupGarbageCollectionTracking(Environment* env) {
296296
static_cast<void*>(env));
297297
env->isolate()->AddGCEpilogueCallback(MarkGarbageCollectionEnd,
298298
static_cast<void*>(env));
299+
env->AddCleanupHook([](void* data) {
300+
Environment* env = static_cast<Environment*>(data);
301+
env->isolate()->RemoveGCPrologueCallback(MarkGarbageCollectionStart, data);
302+
env->isolate()->RemoveGCEpilogueCallback(MarkGarbageCollectionEnd, data);
303+
}, env);
299304
}
300305

301306
// Gets the name of a function

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.