Hi Desiree,
On Fri, 2004-08-27 at 07:38, Désirée Görrisen wrote:
> I have still another question concerning memory handling.
>
> OK, OpenSG cleans up all Objects which get a refcount of 0, right?
> So a NodePtr which is created and added as child to another one will be
> deleted, when the parent is deleted, because addChild increments the
> refcount and subChild decrements it....
> But what happens with a node which is created but never inserted into
> the scene graph, like that:
>
> NodePtr neverDeletedNode = Node::create();
> // this node exists and has a refcount of zero
>
> Will this one never be deleted, because the refcount will never be
> incremented but also never decremented back to zero?
Yes, this Node will never be deleted. You can force it to be deleted by
using a RefPtr to store it.
RefPtr<NodePtr> willBeDeletedNode = Node::create();
// this node exists and has a refcount of one
When the willBeDeletedNode goes out of scope the refcount will be
decremented and the node will be deleted.
Hope it helps
Dirk
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users