Re: [osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Alberto Luaces
Bruno Oliveira writes:

> I am using Ubuntu's System monitor.
> How can I measure it more accurately?

A good tool is valgrind's massif
(http://valgrind.org/docs/manual/ms-manual.html)

-- 
Alberto

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Bruno Oliveira
I am using Ubuntu's System monitor.
How can I measure it more accurately?

2016-05-13 13:08 GMT+01:00 Alberto Luaces :

> Bruno Oliveira writes:
>
> > Hello,
> >
> > thank you for your answaer. However, that does not have any effect :(
>
> One thing you are not stating is how are you measuring your memory
> consumption.  Relaying on OS stats may not be precise enough since when
> one frees some memory block, OSes tend to not returning it back
> immediately to the general memory pool.
>
> --
> Alberto
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Alberto Luaces
Bruno Oliveira writes:

> Hello,
>
> thank you for your answaer. However, that does not have any effect :(

One thing you are not stating is how are you measuring your memory
consumption.  Relaying on OS stats may not be precise enough since when
one frees some memory block, OSes tend to not returning it back
immediately to the general memory pool.

-- 
Alberto

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Bruno Oliveira
Hello,

thank you for your answaer. However, that does not have any effect :(

2016-05-13 11:13 GMT+01:00 Jannik Heller :

> Hi,
>
> There may be some memory allocations left in the graphics driver. OSG does
> all the OpenGL work from a background thread, so the memory used by OpenGL
> can not be reclaimed immediately upon removing the node from the scene. Try
> calling frame() a few times and then see if your memory usage decreases
> again.
>
> Cheers,
> Jannik
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67088#67088
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Jannik Heller
Hi,

There may be some memory allocations left in the graphics driver. OSG does all 
the OpenGL work from a background thread, so the memory used by OpenGL can not 
be reclaimed immediately upon removing the node from the scene. Try calling 
frame() a few times and then see if your memory usage decreases again.

Cheers,
Jannik

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67088#67088





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Bruno Oliveira
Hello,

I have spent a great deal of time trying to figure out OSG's memory
management.
I have a scene graph with several children (actually a LOD based on an
octree).

However, when I need to reset my scene (I just want to wipe ALL nodes from
de scene and also wipe the memory), I use

// Clear main osg::Group root node
m_rootNode->removeChildren(0, m_rootNode->getNumChildren());
m_rootNode->dirtyBound();

// Clear Main view scene data from osg::Viewer
m_viewer->setSceneData(nullptr);


BEFORE I do this, I check all my nodes with a NodeVisitor pattern, and
found out that ALL my nodes have reference count of 1, i.e, after clearing
them from the scene, I expect my memory to be freed. However, this does not
happen: my scene is actually reset, all the nodes disappear from the
viewer, but the memory remains occupied.

Nonetheless, when I load another scene to my viewer, the memory is
rewritten somehow (i.e., the memory usage does not increase, hence there is
no memory leak, but used memory is always the same)

I can't have this behaviour, as I need to closely control memory usage. How
can I do this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org