Hi Julian,

On 6 June 2016 at 13:01, Julien Valentin <[email protected]> wrote:
> Are you sure about circular reference and memory leak...? Is ref_ptr not 
> built in order to adress such issue?..

Automatically detecting and avoiding ciruclar references would be
massively complicated to implement, ref_ptr<> obsoletely doesn't
detect or avoid circular references.  I don't know of any C++ smart
pointers that are capable of avoiding circular references.


>  This would be great that BufferObject would store refpointed BufferData.

Aarrrgggh.... You can't do this, it's a circular reference.


> It would allow to let user choose with which he wanna play with (BufferData 
> or BufferObject)
> (As far as I know the only place where bufferData are released is in 
> UnrefImageAfterApply textureXD management)
>
> Further I tested it (use ref_ptr <BufferData> in BufferObject) and didn't see 
> any problem in the use cases I have checked ( I even put circular ref in 
> BufferData BufferObject  serializers and it seams to works great)

The problem is you've created a memory leak that is never detectable
or fixable with  lots of hardwiring to undo the circular reference.

You need to take a step back and learn a bit more about the
implications of memory management.  osg-submissions isn't the place to
teachiyou this stuff.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to