Using too many Nodes is bad: it leads to memory leaks (especially if one uses remove_child instead of queue_free: generally one should always prefer the ~former~ latter).
However, Nodes are sometimes necessary. The HTTPRequest class is a Node, so any class that contains a HTTPRequest needs to be a Node.
When deciding a base class to extend, this should be the priority order:
RefCounted (or Resource if persistence is required): automatic memory management, no need to worry about leaks [^1].
Node: memory is somewhat managed automatically (a Node is deallocated whenever its parent is). But they can still be retained too much, for example if one removes a node from the scene tree but does not delete the node itself (as when using remove_child).
Object: manual management.
Tasks:
[ ] Make sure all exposed classes follow the rules above.
[^1]: There can still be long-lived references or cyclic references, but this is still the best option I think.
Using too many Nodes is bad: it leads to memory leaks (especially if one uses
remove_child
instead ofqueue_free
: generally one should always prefer the ~former~ latter).However, Nodes are sometimes necessary. The HTTPRequest class is a
Node
, so any class that contains aHTTPRequest
needs to be aNode
.When deciding a base class to extend, this should be the priority order:
RefCounted
(orResource
if persistence is required): automatic memory management, no need to worry about leaks [^1].Node
: memory is somewhat managed automatically (aNode
is deallocated whenever its parent is). But they can still be retained too much, for example if one removes a node from the scene tree but does not delete the node itself (as when usingremove_child
).Object
: manual management.Tasks:
[^1]: There can still be long-lived references or cyclic references, but this is still the best option I think.