[osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

Robert Osfield robert.osfield at gmail.com
Fri Jul 25 01:21:42 PDT 2008


Hi Viggo,

On Fri, Jul 25, 2008 at 7:22 AM, Viggo Løvli <vigigio at hotmail.com> wrote:
> Hi Robert,
>
> My current code instances a new one each cull traverse. I wonder if that
> means I get a sizeof(osgUtil::RenderBin) memory leak each cull-traverse?

The rendering backend uses ref_ptr<>'s so there shouldn't be any leak,
assigning the new RenderBin will lead to the previous one being
deleted.

> Anyway, I am going to try to multi-buffer it.
> I should be able to count the number of cull-traverse calls I get for each
> update tranverse. That (I guess) should tell me automatically how many
> instances of osgUtil::RenderBin that I would need. I will multiply it by two
> for double buffering and then it should work like a dream.

Rather than second guess what will be need might I suggest you
maintain a recycling list of ref_ptr<> to your custom RenderBin, then
traverse this list to find an entry that has a referenceCount() of
one, then take ownership of this.

Robert.



More information about the osg-users mailing list