<div dir="ltr"><div><div><div>I checked with valgrind, and effectively I did not find any memory leak.<br></div><br></div>The OS System Monitor (Ubuntu, as I said) consistently presents double the memory valgrind does (e.g., System Monitor says the app is using 2Gb, while valgrind states it is 1GB).<br><br></div>My data (a point cloud) is actually 1GB (binary format). I thought the 2GB came from OSG or OpenGL driver keeping a copy of my data for some reason.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-13 16:23 GMT+01:00 Alberto Luaces <span dir="ltr"><<a href="mailto:aluaces@udc.es" target="_blank">aluaces@udc.es</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think some facts must be made clear:<br>
<br>
* You cannot control when the OpenGL driver releases the memory it<br>
  claimed in a previous instant.<br>
<br>
* You cannot control when the operating system claims back the memory<br>
  pages that a process requested, and in addition, many times it is<br>
  simply not possible to do it due to memory fragmentation.<br>
<br>
* At most, what you can do is to check that your program is not leaking<br>
  memory with a special tool, as the one I recommended (valgrind for<br>
  CPUs, other tools for GPUs).<br>
<br>
System memory tools are completely unreliable for this specific purpose.<br>
<div class="HOEnZb"><div class="h5"><br>
Bruno Oliveira writes:<br>
<br>
> I tried removing the children with m_rootNode->removeChildren(0,<br>
> m_rootNode->getNumChildren());<br>
> but this results in some memory being still allocated.<br>
><br>
> After that, I move the mouse around a bit in the clean scene, and the<br>
> memory starts being freed. However, It never gets to the initial<br>
> value, there is always some memory floating around.<br>
><br>
> 2016-05-13 15:16 GMT+01:00 Alberto Luaces<br>
> <<a href="mailto:aluaces@udc.es">aluaces@udc.es</a>>:<br>
><br>
>     Bruno,<br>
><br>
>     if you read the source code, you will see that the LOD uses the<br>
>     same<br>
>     scheme for storing nodes as a Group: just a vector of ref_ptr that<br>
>     will<br>
>     be unallocated when destroyed.<br>
><br>
>     Maybe you can place some breakpoints at the destructors on the<br>
>     debugger<br>
>     and see what is happening.<br>
><br>
>     Bruno Oliveira writes:<br>
><br>
>     > Thank you for your answer. However, since I'm using a LOD, I<br>
>     think it<br>
>     > is not properly removing my data. At least the memory is still<br>
>     > allocated.<br>
>     > If I manually iterate over all nodes and delete them by myself,<br>
>     some<br>
>     > memory is freed, but not all!<br>
>     ><br>
>     > 2016-05-13 14:58 GMT+01:00 Alberto Luaces<br>
>     ><br>
>     ><br>
><br>
><br>
>     > Bruno Oliveira writes:<br>
>     ><br>
>     > > At some point I want to completely wipe out my scene. How can<br>
>     I<br>
>     > delete<br>
>     > > all nodes?<br>
>     ><br>
>     > If you want to wipe a node and all its descendants, just delete<br>
>     > the<br>
>     > parent node. That is what reference counting is all about.<br>
><br>
>     --<br>
>     Alberto<br>
><br>
>     _______________________________________________<br>
>     osg-users mailing list<br>
>     <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
>     <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
><br>
><br>
><br>
><br>
<br>
--<br>
Alberto<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</div></div></blockquote></div><br></div>