Hi Xiaoshuxing, On 12/13/06, xiaoshuxing <[EMAIL PROTECTED]> wrote:
Hello, everyone: Osg::ref_ptr is used automatically manage the memory allocation, but it only release the memory when the point is out of scope What should I do if I want to release the memory the pointer is pointing to explicitly? In my program, I want to delete the whole scene, and change to another scene. But the osg::ref_ptr<> pointer is defined as a global variable which will not be out of scope. I've used a recursive call to "unref" every node in the tree, but errors happens, saying that "access violation". Is there any suggestion?
As Ivan says trust in ref_ptr<>, do not go unref'ing nodes as this is the road to certain disaster. To release memory simply assing your global to the new subgraph, or set the global ref_ptr<> to 0 and everything that is safe to be deleted will be. Robert. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
