[osg-users] how to release loaded model

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Thu Jul 24 05:50:45 PDT 2008

Hello Robert,

> ref_ptr::release() is a specialist helper method with does an
> unref_noDelete on the referenced object - it deliberately doesn't
> delete the object that it's unrefecing.  This functionality is
> required for functions that use ref_ptr<> locally but then have to
> pass a C* point of the object.

I have seen this confusion before from people used to Win32 
programming... In MFC (I believe), calling release() on something means 
you don't want to use it anymore, and you want it to release its 
resources (kind of like calling delete on a pointer, but it's a C API so 
there are no destructors, hence the release() function). So it means 
exactly the opposite of what it means in OSG.

Kind of ironic, but perhaps that just means that people need to read the 
API documentation a bit before using a method in their code, because it 
might not do what they assume it does.

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list