One more suggestion: you don&#39;t really need to recreate the renderer every time. What I usually do is keep the renderer around, and call RemoveAllViewProps() on it to remove all existing actors, and add new ones.<div><br>
</div><div>In fact, very often, I find myself just replacing the input to various mappers, while keeping the renderer, render window, and even the actors and mappers intact. This usually keeps things sane for me.</div><div>
<br></div><div>The way memory management works is that if you have other objects that hold onto the object being deleted, only the reference count is reduced, and the memory isn&#39;t freed up. When you call SetInput(...) on a mapper, for example, there is a reference created between the data object you set as input, and the mapper. If you haven&#39;t deleted the data object, it&#39;ll hold onto the mapper, even though you&#39;ve called Delete(), or for that matter, used a smart pointer, which is a scoped pointer that calls Delete() on the object when it leaves scope.</div>
<div><br></div><div>Most often, memory problems of this type come from the readers or other pipeline stages that you&#39;ve forgotten to clean up when replacing your pipeline. Try checking for any other objects that you set as input, or vtkProperty instances that you&#39;ve created and set to the actors, or something of that kind. I think your problem isn&#39;t at the renderer stage.</div>
<div><br></div><div>Shash<br><br><div class="gmail_quote">On Sun, May 22, 2011 at 4:33 PM, G G <span dir="ltr">&lt;<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
When I use <br><br><span style="font-family:courier new,monospace">        ren = NULL;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        ren = vtkSmartPointer&lt;vtkRenderer&gt;::New();</span><div class="im">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">        ren-&gt;SetBackground(1,1,1);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        ren-&gt;AddActor(actor);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        widget-&gt;GetRenderWindow()-&gt;AddRenderer(ren);</span><br><br></div>it works but, memory is grown again. <br><br>when I use <br><br><span style="font-family:courier new,monospace">        ren-&gt;Delete();</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">
        ren = vtkSmartPointer&lt;vtkRenderer&gt;::New();</span><div class="im"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        ren-&gt;SetBackground(1,1,1);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        ren-&gt;AddActor(actor);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        widget-&gt;GetRenderWindow()-&gt;AddRenderer(ren);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
</span><br></div>it doesnt work.<br><br>I am desperate. :(<div><div></div><div class="h5"><br><br><div class="gmail_quote">2011/5/22 G G <span dir="ltr">&lt;<a href="mailto:greenlander1986@gmail.com" target="_blank">greenlander1986@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am trying now. In VTK examples Examples\GUI\Qt\Events is in global scope only vtkRenderer... I have tried according this, but it crash in <br><span style="font-family:courier new,monospace">        cout&lt;&lt;&quot;bla&quot;&lt;&lt;endl;</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">        ren = NULL;</span><div><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        ren-&gt;SetBackground(1,1,1);</span><br style="font-family:courier new,monospace">


</div><span style="font-family:courier new,monospace">        ren-&gt;AddActor(actor);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        widget-&gt;GetRenderWindow()-&gt;AddRenderer(ren);</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">        cout&lt;&lt;&quot;ups&quot;&lt;&lt;endl;</span><br style="font-family:courier new,monospace">&quot;bla&quot; is written, but &quot;ups&quot; not. I have in all important method <br>


vtkSmartPointer&lt;vtkRenderer&gt; ren<br><br>inicialization I do only ones, it is problem?<div><div></div><div><br><br><br><div class="gmail_quote">2011/5/21 G G <span dir="ltr">&lt;<a href="mailto:greenlander1986@gmail.com" target="_blank">greenlander1986@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you, I try it. And post here solution<br><br><div class="gmail_quote"><div>2011/5/21 chasank <span dir="ltr">&lt;<a href="mailto:chasank@gmail.com" target="_blank">chasank@gmail.com</a>&gt;</span><br>


</div><div><div></div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My suggestion is,<br>
 if you do not need more than one renderer and RenderWindow<br>
 - Define them in a global scope,<br>
 - And before each call to the widgetInicialization method, set them to the<br>
NULL<br>
 - in widgetInicialization method, Re-create them, set the values<br>
 - Lastly update your widget object.<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/growing-RAM-memory-tp4346305p4415624.html" target="_blank">http://vtk.1045678.n5.nabble.com/growing-RAM-memory-tp4346305p4415624.html</a><br>
</font><div><div></div><div>Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>