<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">you're leaking a dataset with each
      iteration. You need to <br>
      <br>
      Delete(reader) <br>
      del reader<br>
      <br>
      each iteration.<br>
      <br>
      <br>
      --- original.py 2013-11-08 11:52:45.746871024 -0800<br>
      +++ fixleak.py&nbsp; 2013-11-08 11:56:32.226876191 -0800<br>
      @@ -15,15 +15,13 @@<br>
      &nbsp;<br>
      &nbsp;while true == 1:<br>
      &nbsp;&nbsp;&nbsp;&nbsp; OutPutFile =
      OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'<br>
      -&nbsp;&nbsp;&nbsp; <br>
      -&nbsp;&nbsp;&nbsp; while exist == 0:<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with open(OutPutFile):<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exist = 1<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except IOError:<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exist = 0<br>
      -&nbsp;&nbsp;&nbsp; exist = 0<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
      +&nbsp;&nbsp;&nbsp; if os.path.exists(OutPutFile)<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise RuntimeError('File %s deosnt exist'%(OutPutFile))<br>
      +<br>
      +&nbsp;&nbsp;&nbsp; if reader:<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delete(reader)<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; del reader<br>
      +<br>
      &nbsp;&nbsp;&nbsp;&nbsp; reader = OpenDataFile(OutPutFile)<br>
      &nbsp;<br>
      &nbsp;&nbsp;&nbsp;&nbsp; reader.PointData<br>
      @@ -47,13 +45,5 @@<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cam.Elevation(30)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cam.Azimuth(30)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Render()<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
      +<br>
      &nbsp;&nbsp;&nbsp;&nbsp; count = count + 1<br>
      -# Stop the script killing itself<br>
      -&nbsp;&nbsp;&nbsp; nOutPutFile =
      OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'<br>
      -&nbsp;&nbsp;&nbsp; while exist == 0:<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with open(nOutPutFile):<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exist = 1<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except IOError:<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exist = 0<br>
      <br>
      <br>
      On 11/08/2013 10:34 AM, Junyi Han wrote:<br>
    </div>
    <blockquote
cite="mid:CA+dOOGiOUUZV-v7Rp0Hc9gaXYnwNDwag8bxp2COKECsQ+L0KTA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Hi,</div>
        <div><br>
        </div>
        <div>Thanks for your reply. Below is my script:</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>'''</div>
        <div>Created on 29 Oct 2013</div>
        <div><br>
        </div>
        <div>@author: Junyi Han</div>
        <div>'''</div>
        <div>from paraview.simple import *</div>
        <div><br>
        </div>
        <div>PVServer = 'localhost'</div>
        <div>OutPutLocation =
          '/home/johnny/Application/DPD/myDPD-PVersion/'</div>
        <div>exist = 0</div>
        <div>count = 0</div>
        <div>true = 1</div>
        <div><br>
        </div>
        <div>Connect(PVServer)</div>
        <div><br>
        </div>
        <div>while true == 1:</div>
        <div>&nbsp; &nbsp; OutPutFile =
          OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'</div>
        <div>
          &nbsp; &nbsp;&nbsp;</div>
        <div>&nbsp; &nbsp; while exist == 0:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; try:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with open(OutPutFile):</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exist = 1</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; except IOError:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exist = 0</div>
        <div>&nbsp; &nbsp; exist = 0</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
        <div>&nbsp; &nbsp; reader = OpenDataFile(OutPutFile)</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp; reader.PointData</div>
        <div>&nbsp; &nbsp; view = GetRenderView()</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp; dp = GetDisplayProperties()</div>
        <div>&nbsp; &nbsp; dp.Representation = 'Surface'</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp; readerRep = GetRepresentation()</div>
        <div>&nbsp; &nbsp; readerRep.ColorArrayName = 'density_01'</div>
        <div><br>
        </div>
        <div># Force read</div>
        <div>&nbsp; &nbsp; reader.UpdatePipeline()</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp; Show(reader)</div>
        <div>&nbsp; &nbsp; Render()</div>
        <div><br>
        </div>
        <div># Get a nice view angle</div>
        <div>&nbsp; &nbsp; if count == 0:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; cam = GetActiveCamera()</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; cam.Elevation(30)</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; cam.Azimuth(30)</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; Render()</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
        <div>&nbsp; &nbsp; count = count + 1</div>
        <div># Stop the script killing itself</div>
        <div>&nbsp; &nbsp; nOutPutFile =
          OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'</div>
        <div>&nbsp; &nbsp; while exist == 0:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; try:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with open(nOutPutFile):</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exist = 1</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; except IOError:</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exist = 0</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2013/11/8 Burlen Loring <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:bloring@lbl.gov" target="_blank">bloring@lbl.gov</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <div>it sounds like what happens when one leaks datasets,
                filters, or other vtk objects that hold large amounts of
                data. Could you share your script?&nbsp; <br>
                <div>
                  <div class="h5"> <br>
                    <br>
                    On 11/08/2013 09:55 AM, Junyi Han wrote:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div dir="ltr">Hi,
                      <div><br>
                      </div>
                      <div>I'm using python script to read data files.
                        Render() function is called as many times as the
                        number of files. I found that after I call
                        render() for 40 or 50 times, the speed of
                        rendering is very slow. Is there a way to solve
                        it? Instead of calling Render() function several
                        times, is there a way to update or re-render?</div>
                      <div><br>
                      </div>
                      <div>Best wishes,</div>
                      <div>Junyi Han</div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </div>
                <pre>_______________________________________________
Powered by <a moz-do-not-send="true" href="http://www.kitware.com" target="_blank">www.kitware.com</a>

Visit other Kitware open-source projects at <a moz-do-not-send="true" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the ParaView Wiki at: <a moz-do-not-send="true" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a>

Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a>
</pre>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>