Skip to content

domain: avoid circular memory references

Rodrigo Muino Tomonari requested to merge github/fork/addaleax/domain-leak into master

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 iddomain 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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading