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

2008-11-19 Thread Chris Denham
em would now be less 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" Message-ID: <[EMAIL PROTECTED]> Content-Type: tex

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

2008-11-18 Thread Simon Hammett
2008/11/18 Chris Denham <[EMAIL PROTECTED]>: > Thanks for the tips everyone. > I suppose as Paul suggests, it's best to avoid doing things that hurt. > The problem is that when we accidentally implemented this pattern in a > more complex application, it was a bit fiddly to track down. I only > noti

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

2008-11-18 Thread Chris Denham
-0700 From: "Paul Martz" <[EMAIL PROTECTED]> Subject: Re: [osg-users] A very simple ref_ptr memory leak example. To: "'OpenSceneGraph Users'" Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" > Using ref_ptr's is fa

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

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 > anothe

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 Chris Denham
rs" Sent: Tuesday, 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 checkin

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 s

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

2008-11-18 Thread Chris Denham
tr, so I'm 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

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

[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 leak