summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-11-04 22:25:18 +0100
committerEvan Lucas <evanlucas@me.com>2017-11-13 07:59:50 -0600
commita79d86db21349c4c232026caa36ef24c2290cf61 (patch)
tree6747c0a5f276f6a44aa6f45066dd9ed6f3420e93
parent74f33724a228293267db250ddf6071fcf5852fa7 (diff)
downloadnode-new-a79d86db21349c4c232026caa36ef24c2290cf61.tar.gz
src: use unrefed async for GC tracking
Do not let an internal handle keep the event loop alive. PR-URL: https://github.com/nodejs/node/pull/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>
-rw-r--r--src/node_perf.cc1
-rw-r--r--test/parallel/test-performance-gc.js2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc
index f5aafbab63..155f1e66e4 100644
--- a/src/node_perf.cc
+++ b/src/node_perf.cc
@@ -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_,
diff --git a/test/parallel/test-performance-gc.js b/test/parallel/test-performance-gc.js
index 1ff4c9ae62..89a9041c1c 100644
--- a/test/parallel/test-performance-gc.js
+++ b/test/parallel/test-performance-gc.js
@@ -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));
}