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 4088089

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
src: use unrefed async for GC tracking
Do not let an internal handle keep the event loop alive. PR-URL: #16758 Fixes: https://github.com/node/issues/16210 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 8f0793f commit 4088089
Copy full SHA for 4088089

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

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

‎src/node_perf.cc‎

Copy file name to clipboardExpand all lines: src/node_perf.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ void MarkGarbageCollectionEnd(Isolate* isolate,
215215
uv_async_t* async = new uv_async_t(); // coverity[leaked_storage]
216216
if (uv_async_init(env->event_loop(), async, PerformanceGCCallback))
217217
return delete async;
218+
uv_unref(reinterpret_cast<uv_handle_t*>(async));
218219
async->data =
219220
new PerformanceEntry::Data(env, "gc", "gc",
220221
performance_last_gc_start_mark_,
Collapse file

‎test/parallel/test-performance-gc.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-performance-gc.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ const kinds = [
4848
}));
4949
obs.observe({ entryTypes: ['gc'] });
5050
global.gc();
51+
// Keep the event loop alive to witness the GC async callback happen.
52+
setImmediate(() => setImmediate(() => 0));
5153
}

0 commit comments

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