[osg-users] found memory leak in OSG 3.0.1

Robert Osfield robert.osfield at gmail.com
Thu Jan 19 09:52:36 PST 2017


Hi Gianluca,

How you are measuring the memory usage?  It could simply be that the
memory tracking isn't properly handling deallocations.

As a general note, close will just close the graphics context, it
won't delete the osg::GraphicsWindowWin32.  Try testing the creation
of a viewer within a well defined scope and then see what memory has
been deallocated or not on leaving the scope where all the viewer
related objects should be cleaned up.

Robert.

On 19 January 2017 at 17:02, Gianluca Natale <natale at europe.altair.com> wrote:
> Hi all,
>
> In my application I’m using OSG 3.0.1 (I do know it is old, but I do not
> have the time now to move to a newer version).
>
> I think I have a memory leak, and I don’t know if it’s my fault or a bug in
> OSG.
>
> Using the task manager (on Win 8.1 Pro), I see this.
>
>
>
> When I call:
>
>
>
> GraphicsContext* GraphicsContext::createGraphicsContext(Traits* traits);
>
>
>
> memory allocated in my application increases of about 2.5 MB.
>
>
>
> Then, when I call:
>
>
>
> GraphicsContext::close(bool callCloseImplementation); // I pass true to this
> function
>
>
>
> memory allocated in my application decreases of about 1.5 MB.
>
> So, there is always  about 1 MB that is not deallocated.
>
>
>
> I tried to investigate a bit, and noticed that the problem seems to happen
> inside this function:
>
>
>
> bool GraphicsWindowWin32::setWindow( HWND handle ).
>
>
>
> Specifically, there are 2 calls in that function where memory is allocated:
>
>
>
> 1)      bool GraphicsWindowWin32::setPixelFormat(); // increases about 1 MB
>
> 2)      HGLRC GraphicsWindowWin32::createContextImplementation(); //
> increases about 1.5 MB
>
>
>
> So, it looks like the memory allocated at point 1 is never released.
>
> Is there anything I have to call, when I want to destroy a graphic context,
> other than close()?
>
> Or, if you do know that it is a memory leak, has it been fixed in a newer
> version of OSG?
>
>
> Thanks,
>
> Gianluca Natale
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list