<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 2013-11-08 11:56:32.226876191 -0800<br>
@@ -15,15 +15,13 @@<br>
<br>
while true == 1:<br>
OutPutFile =
OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'<br>
- <br>
- while exist == 0:<br>
- try:<br>
- with open(OutPutFile):<br>
- exist = 1<br>
- except IOError:<br>
- exist = 0<br>
- exist = 0<br>
- <br>
+ if os.path.exists(OutPutFile)<br>
+ raise RuntimeError('File %s deosnt exist'%(OutPutFile))<br>
+<br>
+ if reader:<br>
+ Delete(reader)<br>
+ del reader<br>
+<br>
reader = OpenDataFile(OutPutFile)<br>
<br>
reader.PointData<br>
@@ -47,13 +45,5 @@<br>
cam.Elevation(30)<br>
cam.Azimuth(30)<br>
Render()<br>
- <br>
+<br>
count = count + 1<br>
-# Stop the script killing itself<br>
- nOutPutFile =
OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'<br>
- while exist == 0:<br>
- try:<br>
- with open(nOutPutFile):<br>
- exist = 1<br>
- except IOError:<br>
- 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> OutPutFile =
OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'</div>
<div>
</div>
<div> while exist == 0:</div>
<div> try:</div>
<div> with open(OutPutFile):</div>
<div> exist = 1</div>
<div> except IOError:</div>
<div> exist = 0</div>
<div> exist = 0</div>
<div> </div>
<div> reader = OpenDataFile(OutPutFile)</div>
<div><br>
</div>
<div> reader.PointData</div>
<div> view = GetRenderView()</div>
<div><br>
</div>
<div> dp = GetDisplayProperties()</div>
<div> dp.Representation = 'Surface'</div>
<div><br>
</div>
<div> readerRep = GetRepresentation()</div>
<div> readerRep.ColorArrayName = 'density_01'</div>
<div><br>
</div>
<div># Force read</div>
<div> reader.UpdatePipeline()</div>
<div><br>
</div>
<div> Show(reader)</div>
<div> Render()</div>
<div><br>
</div>
<div># Get a nice view angle</div>
<div> if count == 0:</div>
<div> cam = GetActiveCamera()</div>
<div> cam.Elevation(30)</div>
<div> cam.Azimuth(30)</div>
<div> Render()</div>
<div> </div>
<div> count = count + 1</div>
<div># Stop the script killing itself</div>
<div> nOutPutFile =
OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'</div>
<div> while exist == 0:</div>
<div> try:</div>
<div> with open(nOutPutFile):</div>
<div> exist = 1</div>
<div> except IOError:</div>
<div> 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"><<a moz-do-not-send="true"
href="mailto:bloring@lbl.gov" target="_blank">bloring@lbl.gov</a>></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? <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>