I am not sure I understand. So always when I create osg::* objects (like this array) I also wrap it in ref_ptr? Another problem is, why compile of delete vec3array fails...? how then ref_ptr removes it,if delete fails?
Second question, if I create hierarhy of nodes, do I: 1. Have to delete root? 2. Dont have to delete anything, since root is pointed on class level with ref_ptr? 3. Alway wrap everything in ref_prt., or just root? 4. On "class level", should I store only ref_ptr to root, or also to child nodes The problem is that I "restart" scene many times, and I clearly have huge memory leaks. Thanks! 2006/11/22, Robert Osfield <[EMAIL PROTECTED]>:
HI Gordon, On 11/22/06, Gordon Tomlinson <[EMAIL PROTECTED]> wrote: > I understand the point but the Gents example was not using a Ref pointer, > hence the way I replied :) The best advice was to use ref_ptr<> without a shadow of doubt. > But I would also argue that theres nothing wrong in using unref() if you > know what the life cycle of your object is. It is not a robust way to program. What happens when an exception occurs? Memory leak? what happens if you move the code around a bit and the code path missing a ref/unref? Calling unref() mannually is a *bad* programming practice that one shouldn't get it in. ref_ptr<> is your friend, it will help your out immensely, it frees you from worry about memory management because it does it so robustly. Robert. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
