[x3d-public] removeNamedNode removes DEF children?

Andreas Plesch andreasplesch at gmail.com
Tue Jul 12 12:04:32 PDT 2022


Thanks, makes sense. Andreas

---on the phone---

On Tue, Jul 12, 2022, 5:35 AM Patrick Dähne <pdaehne at gmail.com> wrote:

>
>
> > Here is one last clarification. After all occurrences of a node are
> removed from a scene, can it still be readded as a USE, named node ? It
> appears so. In SAI terms, getNamedNode() does not rely on if a node is
> currently used in a scene ?
> >
> > That means a named node may never be released from memory.
> >
> > But unnaming such an unlinked node with removeNamedNode should make it
> safe to remove from memory ?
>
> A node gets garbage collected when
>
> a) it is no longer part of the scene graph, i.e. it is not a root node of
> a live scene, and it is not contained in the field of another live node, and
>
> b) there is no reference from user code (either externally or in a Script
> node) to the node.
>
> ROUTEs do not prevent nodes from getting garbage collected, as well as DEF
> names.
>
> To answer your questions:
>
> - You can re-add a node, because you still have a reference to it in your
> user code.
>
> - A named node gets released from memory when it is no longer part of the
> scene graph and there is no reference to it in your user code.
>
> Bye,
>
> Patrick
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220712/ec1d5e5b/attachment.html>


More information about the x3d-public mailing list