<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->GetPointData()->SetScalars( bathyArray);</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); "> uGrid->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->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->SetInputConnection( gf->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->ThresholdByUpper( BAD_VALUE );</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">thr->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->SetInputConnection( thr->GetOutputPort());</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">contGrid->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->Set
InputConnection( contGrid->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->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->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->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->SetMapper(ldm);</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">pRenderer->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->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->Delete();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">contGrid->Delete();</span></div><div><span class="Apple-style-span" style="font-family: Arial; color: rgb(51, 51, 51); ">ldm->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>