domain: avoid circular memory references
src: add WeakReference utility
Add a simple WeakReference
utility that we can use until the
language provides something on its own.
domain: avoid circular memory references
Avoid circular references that the JS engine cannot see through
because it involves an async id
⇒ domain
link.
Using weak references is not a great solution, because it increases the domain module’s dependency on internals and the added calls into C++ may affect performance, but it seems like the least bad one.
Fixes: https://github.com/nodejs/node/issues/23862
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines