Skip to content

Commit 6e60ab7

Browse files
joyeecheungnodejs-github-bot
authored andcommitted
src: annotate BaseObjects in the heap snapshots correctly
This fixes two issues in the BaseObject views in the heap snapshots: 1. BaseObjects are not conceptually roots when the environment and the realms are also showing up in the heap snapshot. Rather, they should be considered being held alive by the BaseObjectList in the realms, which are in turn held alive by Environment. The actual root from the containment view should be the Environment instead. 2. The concept of DOM detaching does not really apply to Node.js wrappers, and it's confusing to connect that with the weakness or detachment (native weakness) of BaseObjects. To avoid the confusion, just restore to the default detachedness for them. PR-URL: nodejs#57417 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent e86adad commit 6e60ab7

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

src/base_object-inl.h

-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ bool BaseObject::IsWeakOrDetached() const {
125125
return pd->wants_weak_jsobj || pd->is_detached;
126126
}
127127

128-
v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {
129-
return IsWeakOrDetached() ? v8::EmbedderGraph::Node::Detachedness::kDetached
130-
: v8::EmbedderGraph::Node::Detachedness::kUnknown;
131-
}
132-
133128
template <int Field>
134129
void BaseObject::InternalFieldGet(
135130
const v8::FunctionCallbackInfo<v8::Value>& args) {

src/base_object.cc

-4
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ Local<Object> BaseObject::WrappedObject() const {
161161
return object();
162162
}
163163

164-
bool BaseObject::IsRootNode() const {
165-
return !persistent_handle_.IsWeak();
166-
}
167-
168164
bool BaseObject::IsNotIndicativeOfMemoryLeakAtExit() const {
169165
return IsWeakOrDetached();
170166
}

src/base_object.h

-3
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ class BaseObject : public MemoryRetainer {
105105
// to it anymore.
106106
inline bool IsWeakOrDetached() const;
107107

108-
inline v8::EmbedderGraph::Node::Detachedness GetDetachedness() const override;
109-
110108
// Utility to create a FunctionTemplate with one internal field (used for
111109
// the `BaseObject*` pointer) and a constructor that initializes that field
112110
// to `nullptr`.
@@ -192,7 +190,6 @@ class BaseObject : public MemoryRetainer {
192190

193191
private:
194192
v8::Local<v8::Object> WrappedObject() const override;
195-
bool IsRootNode() const override;
196193
void DeleteMe();
197194

198195
// persistent_handle_ needs to be at a fixed offset from the start of the

0 commit comments

Comments
 (0)