Skip to content

Commit

Permalink
src: use unrefed async for GC tracking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and evanlucas committed Nov 13, 2017
1 parent 74f3372 commit a79d86d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ void MarkGarbageCollectionEnd(Isolate* isolate,
uv_async_t* async = new uv_async_t(); // coverity[leaked_storage]
if (uv_async_init(env->event_loop(), async, PerformanceGCCallback))
return delete async;
uv_unref(reinterpret_cast<uv_handle_t*>(async));
async->data =
new PerformanceEntry::Data(env, "gc", "gc",
performance_last_gc_start_mark_,
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-performance-gc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ const kinds = [
}));
obs.observe({ entryTypes: ['gc'] });
global.gc();
// Keep the event loop alive to witness the GC async callback happen.
setImmediate(() => setImmediate(() => 0));
}

0 comments on commit a79d86d

Please sign in to comment.