HI Robin,

Thanks for isolating this bug.  I've done a review and your code while
fixing the leak isn't a full fix as the lines of code you modified
aren't actually needed at all.  Your code was:

        if (skirtDrawElements->getNumIndices()!=0)
        {
            geometry->addPrimitiveSet(skirtDrawElements.get());
            skirtDrawElements = smallTile ?
                static_cast<osg::DrawElements*>(new
osg::DrawElementsUShort(GL_QUAD_STRIP)) :
                static_cast<osg::DrawElements*>(new
osg::DrawElementsUInt(GL_QUAD_STRIP));
        }

While the actual code that is appropriate is simply:

        if (skirtDrawElements->getNumIndices()!=0)
        {
            geometry->addPrimitiveSet(skirtDrawElements.get());
        }

The reason is that this last addPrimitiveSet is the last one in the if
() {} block so there is no need to allocate another skirtDrawElements
object.

This change is now checked into svn/trunk.

I'm still doing testing and believe there is still may be a memory
leak elsewhere when paging as the growth in memory usage while slow
does still seem to persist.

Robert.


On Thu, May 6, 2010 at 2:05 PM, Robin Bourianes
<[email protected]> wrote:
> Hi list,
>
> here's a tiny patch for what I guess is a copy & paste bug leading to a
> memory leak. I also added the full file as requested by the Submission
> Protocol. This was found with valgrind's tool memcheck.
> The patch was created against OpenSceneGraph r11406, so is the file.
> About copyright, I assign mine over to project leads (is this the
> correct way to say it ?).
>
> Cheers,
> Robin.
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to