if (TheNode.get() ){
       osg::Node::ParentList parents = TheNode->getParents();
       for(osg::Node::ParentList::iterator pitr=parents.begin();
           pitr!=parents.end();
           ++pitr)
       {
           (*pitr)->removeChild(TheNode.get());
       }
   }

And then remove the reference like this:

TheNode= NULL;

So if I really got all references removed, it should delete the node, right?

I have the impression that the node doesn´t get deleted (I created some hundred nodes for testing and removed them this way, memory-consumption didn´t go down), so either my approach is wrong, or I forgot some reference somewhere.

I´ve got this working now. It seems that osg nodes have a small memory footprint, so I have to remove a big lot of them to see an effect.

Regards,

Andreas


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to