>> ref_ptrs are used to keep a reference count. So, each object that is being >> referenced >> by another keeps a count of how many other objects are referencing it.
I appreciate the pointers (pardon the pun) about ref_ptrs. However, we've gotten off the topic I asked about. I'll try again, more to the point... I load an object, let's say a model of a vehicle. I later use a ref_ptr to reference a PART of this object (specifically a VertexArray within one of the object's Geometry drawables). Note: This is the important distinction: I have additionally ref'ed the VertexArray COMPONENT of the Geometry. I later remove the vehicle object WHILE a ref_ptr still references the Vertex Array within the object. [Let's say the code that handles removing objects is unaware that other code created a ref_ptr to the Geometry's VertexArray] I believe it's safe to say that the object will be unref'ed and it will traverse down the graph unref'ing the children, causing their deletion. However... I have a single VertexArray within a single Geometry that is STILL referenced by the ref_ptr I created. [To be clear: At the time of removing the object, all of the child entities of the loaded model have a refCount of 1, EXCEPT one of the VertexArrays which has a refCount of *2* due to the additional ref_ptr] The question is: When the object is removed, will ONLY the still-referenced VertexArray be left in memory (due to the reference to it)? Or will the fact that the Geometry has a still-referenced VertexArray cause that Geometry or Geode (...or...?) to ALSO be left in memory because it couldn't be fully removed? [To be clear: If children are being unreferenced and deleted and a Geometry contains a component (VertexArray) that is still-referenced at the time the Geometry is unreferenced, are there any ramifications beyond the Vertex Array remaining in memory until it's ref_ptr is destroyed?] I hope this explains the question better... it's not a "how do ref_ptrs work" question - it's a "what happens if a PART of a parent object cannot be fully unreferenced when the parent object is unreferenced and destroyed". Thanks in advance, Bill Prendergast _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
