Hi Ufuk; As I know, If you create a new object with using ref_ptr, object's default ref_ptr should be initialized to 1. And after you have attached it to your scene, ref_ptr count gets 2. And after you delete your geometry from your scene graph ref count gets 1 again. And then this ref_ptr object will be deleted automatically when intelligent ref_ptr decided to it is unneccessary some times later. And then it will be deleted automaticly. Be cool. ref_ptr's target is counting pointer usage and finding unneccesary pointers.
Regards. Ümit Uzun 2009/8/19 Ufuk <ufuk....@gmail.com> > Hi Ismail,thanks for the advice.. > i think what you tell probably works but it is very long process... i > already thought this but i wanted to try my chance here for an easier way.. > these recompiling stuff is not easy for me now... > > anyway there should be an easier way? if i cant find an easier way, > i definitely try what you have said.. > > > > On Wed, Aug 19, 2009 at 3:06 PM, Ismail Pazarbasi <pazarb...@gmail.com>wrote: > >> 2009/8/19 Ufuk <ufuk....@gmail.com>: >> > i have an osg::Geometry. i store it in a class with ref_ptr >> > when i delete it, i expect it to be deleted. >> > in debug, i saw that the reference count is 2 before this destructor. >> > even if i set this value to null, there reference count remains 1. >> > so it is not deleting... >> > >> > what i want to ask is, how can i find who stores reference of my >> geometry. >> > someone stores and increments the reference count without my >> information... >> > do you know a way of doing this? >> > i just want to be informed when my geometry reference count is increased >> so >> > that i can find the memory leak in my project. >> > >> > >> > -- >> > Ufuk >> > >> > _______________________________________________ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> > >> >> Hi Ufuk, >> >> I don't know whether there already is a solution, but I'd suggest you to: >> 1. Add virtual qualifier before osg::Referenced::ref method: >> inline virtual void ref() const; >> 2. Rebuild OSG >> 3. override this method in your custom Geometry class >> class MyGeometry : public osg::Geometry >> { >> public: >> inline virtual void ref() const >> { >> osg::Geometry::ref(); >> } >> }; >> 4. Place breakpoint to that method and see callers. >> >> You can do the same for unref method as well. I haven't tested this >> but seems like to give you some hints. >> >> Ismail >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > > > -- > Ufuk > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org