Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-19 Thread Chris Denham
complete ;-) Chris. Date: Tue, 18 Nov 2008 23:37:00 + From: Simon Hammett [EMAIL PROTECTED] Subject: Re: [osg-users] A very simple ref_ptr memory leak example. To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1

[osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Chris Denham
I'm probably treading very old ground here to do with circular usage of ref_ptr, but it's new to me and I couldn't find any references in the mail archive about users with similar problems. I have pasted below, a very simple example of my usage of ref_ptr that leaks memory. I can see why it

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Enrique Parodi
Try using virtual protected destructors ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Chris Denham
having a look at that. Looks like it may be the ticket! Cheers. Chris. - Original Message - From: Enrique Parodi To: Chris Denham ; OpenSceneGraph Users Sent: Tuesday, November 18, 2008 5:26 PM Subject: Re: [osg-users] A very simple ref_ptr memory leak example. Try using

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Paul Melis
What compiler are you using? The snippet doesn't compile for me with gcc 4.1.2. It's not hard indeed to create cycles, and handling them robustly would mean checking for every reference stored in a Referenced instance if there isn't a cycle. Which is not impossible, but adds a lot of overhead I

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Chris Denham
, November 18, 2008 5:37 PM Subject: Re: [osg-users] A very simple ref_ptr memory leak example. What compiler are you using? The snippet doesn't compile for me with gcc 4.1.2. It's not hard indeed to create cycles, and handling them robustly would mean checking for every reference stored

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Sukender
Hi Chris, Using ref_ptr's is far cheaper than a garbage collector we don't have (... until ISO C++ 2009 ?). osg::observer_ptr could be used to solve the problem, but you can also simply try to avoid circular references... how ? Well, you could try to define an object to be slave of another

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Paul Martz
Using ref_ptr's is far cheaper than a garbage collector we don't have (... until ISO C++ 2009 ?). osg::observer_ptr could be used to solve the problem, but you can also simply try to avoid circular references... how ? Well, you could try to define an object to be slave of another one.

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Sukender
The posted code would behave the same for any type of reference-counted memory management system, I imagine, so isn't really an issue with OSG ref_ptr classes. It's simply an aspect of the algorithm, which programmers must be aware of and be careful to avoid. Or, to put it another way: I

Re: [osg-users] A very simple ref_ptr memory leak example.

2008-11-18 Thread Chris Denham
From: Paul Martz [EMAIL PROTECTED] Subject: Re: [osg-users] A very simple ref_ptr memory leak example. To: 'OpenSceneGraph Users' osg-users@lists.openscenegraph.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Using ref_ptr's is far cheaper than a garbage collector we