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

Reply via email to