<span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">Hello,<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I have this particular function to display contours.. When i iterate this through a loop, for different timestep,</span><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">each time, i set new set of scalars for unstructuredGrid (uGrid) through the means of bathyArray.</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">I get the desired output as i need, but i see that there exists some memory leak.. at each iteration, some amount</span></div><div><span class="Apple-style-span" 
 style="font-family: Arial; color: rgb(51, 51, 51); ">of memory is being held.. I dont know by whom and where.. Below is the code<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">myClass<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">{<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   ...<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   vtkActor2D *element
 NumberActor;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   ...<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">public:<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   ... // Constructors and destructors<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   void DisplayContour();<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; paddin
 g-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   ...<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">};<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Now, i have the function body as follows:<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">void myClass::DisplayConto
 ur()<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">{</span><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">   uGrid-&gt;GetPointData()-&gt;SetScalars( bathyArray);</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">   uGrid-&gt;Update();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">   vtkGeometryFilter *gf = vtkGeometryFilter::New();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">   gf-&gt;SetInput( uGrid );<br style="padding-top: 0px; padding-right: 0px
 ; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">vtkThreshold *thr = vtkThreshold::New();<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">thr-&gt;SetInputConnection( gf-&gt;GetOutputPort() );<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">thr-&gt;ThresholdByUpper( BAD_VALUE );</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">thr-&gt;Update();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><s
 pan class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">vtkContourGrid *contGrid = vtkContourGrid::New();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">contGrid-&gt;SetInputConnection( thr-&gt;GetOutputPort());</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">contGrid-&gt;GenerateValues(n, dataRange);<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">vtkDataSetMapper *ldm = vtkDataSetMapper::New();<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">ldm-&gt;Set
 InputConnection( contGrid-&gt;GetOutputPort() );<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">ldm-&gt;SetScalarRange( dataRange);</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">pRenderer-&gt;RemoveActor(contourActor);</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">if(contourActor)</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">{</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">  contourActor-&gt;Delete();</span></div><div><span class="Apple
 -style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">  contourActor = NULL;</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">}<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">contourActor = vtkActor::New();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">contourActor-&gt;SetMapper(ldm);</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">pRenderer-&gt;AddActor( contourActor );</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="
 font-family: Arial; color: rgb(51, 51, 51); ">gf-&gt;Delete();<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">thr-&gt;Delete();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">contGrid-&gt;Delete();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">ldm-&gt;Delete();<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">}<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></span
 ></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">Can anyone help me or give some clue as what is the mistake i have been doing..?? What can i do to avoid this memory leaks.,?</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">Thanks in advance</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">Regards</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">Rakesh P
 atil</span></div><br><br><div style="border-top:1px dashed #ccc; border-bottom:1px dashed #ccc; padding:5px;"><a href="http://mail.in.com/mails/new_reg.php?utm_source=invite&utm_medium=outgoing" style="font:13px arial; color:#1E56A1; text-decoration:none;">Dear <b>vtkusers !</b> Get Yourself a cool, short <b>@in.com</b> Email ID now!</a></div>