src: do not track BaseObjects via cleanup hooks
Since f59ec2ab, BaseObject
instances were tracked in heap snapshots
through their associated CleanupHookCallback
s which were stored on
the Environment
; however, this is inaccurate, because:
- Edges in heap dumps imply a keeps-alive relationship, but cleanup
hooks do not keep the
BaseObject
s that they point to alive. - It loses information about whether
BaseObject
instances are GC roots: Even weakBaseObject
s are now, practically speaking, showing up as hanging off a GC root when that isn’t actually the case (e.g. in the description of nodejs/node#33468).
Thus, this is a partial revert of f59ec2ab.
Refs: https://github.com/nodejs/node/issues/33468 Refs: https://github.com/nodejs/node/pull/27018
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines