[Paraview] Memory leak with Python script (XDMF and HDF5)
Nikolaos Beratlis
nikos.beratlis at gmail.com
Thu Jun 20 11:15:38 EDT 2013
I am using the following python script to extract images from a series of
files for an animation:
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
index = [None]*9999
m = 0
for i in range(0, 9):
for j in range(0, 9):
for k in range(0, 9):
for l in range(0, 9):
index[m] = chr(i+48)+chr(j+48)+chr(k+48)+chr(l+48)
m = m+1
for i in range(1,2):
cf_VP_anim_xmf = XDMFReader( FileName='XDMF/cf_VP'+index[i]+'.xmf' )
cf_VP_anim_xmf.CellArrays = []
cf_VP_anim_xmf.Sets = []
cf_VP_anim_xmf.PointArrays = ['Cf']
RenderView1 = GetRenderView()
a1_Cf_PVLookupTable = GetLookupTableForArray( "Cf", 1 )
Cfcontours = Show()
Cfcontours.EdgeColor = [0.0, 0.0, 0.50000762951094835]
Cfcontours.SelectionPointFieldDataArrayName = 'Cf'
Cfcontours.ScalarOpacityFunction = []
Cfcontours.ColorArrayName = 'Cf'
Cfcontours.ScalarOpacityUnitDistance = 2.4071425938556859
Cfcontours.LookupTable = a1_Cf_PVLookupTable
Cfcontours.ScaleFactor = 15.0
cf_VP_anim_xmf.Grids = ['STL Grid']
RenderView1.CacheKey = 2.0
RenderView1.CameraClippingRange = [288.47079837284241,
299.16435388730815]
RenderView1.UseCache = 0
a1_Cf_PVLookupTable.RGBPoints = [-0.0080000000000000002, 0.0, 0.0, 1.0,
0.0080000000000000002, 1.0, 0.0, 0.0]
a1_Cf_PVLookupTable.LockScalarRange = 1
separationline = Contour( PointMergeMethod="Uniform Binning" )
separationline.ContourBy = ['POINTS', 'Cf']
separationline.Isosurfaces = [0.0]
DataSeparationLine = Show()
DataSeparationLine.ScaleFactor = 12.321390008926393
DataSeparationLine.SelectionPointFieldDataArrayName = 'Cf'
DataSeparationLine.EdgeColor = [0.0, 0.0, 0.50000762951094835]
DataSeparationLine.LineWidth = 2.0
DataSeparationLine.DiffuseColor = [0.0, 0.0, 0.0]
DataSeparationLine.ColorArrayName = ''
Cfcontours.Visibility = 1
Q_VP_xmf = XDMFReader( FileName='XDMF/Q_VP'+index[i]+'.xmf' )
Q_VP_xmf.CellArrays = []
Q_VP_xmf.Sets = []
Q_VP_xmf.PointArrays = ['Q']
DataQ = Show()
DataQ.Representation = 'Outline'
DataQ.ScaleFactor = 12.341455459594727
DataQ.SelectionPointFieldDataArrayName = 'Q'
DataQ.EdgeColor = [0.0, 0.0, 0.50000762951094835]
Q_VP_xmf.Grids = ['Eulerian Grid']
ContourQ = Contour( PointMergeMethod="Uniform Binning" )
ContourQ.PointMergeMethod = "Uniform Binning"
ContourQ.ContourBy = ['POINTS', 'Q']
ContourQ.Isosurfaces = [1.0]
ContourQ.ComputeNormals = 0
DataQiso = Show()
DataQiso.ScaleFactor = 7.4976861000061037
DataQiso.SelectionPointFieldDataArrayName = 'Normals'
DataQiso.EdgeColor = [0.0, 0.0, 0.50000762951094835]
DataQ.Visibility = 0
#--- Setup view
RenderView1 = GetRenderView()
RenderView1.Background = [1.0, 1.0, 1.0]
RenderView1.CenterAxesVisibility = 0
RenderView1.OrientationAxesVisibility = 0
RenderView1.ViewSize = [2000, 350]
RenderView1.CameraViewUp = [0.0,-1.0, -2.2204460492503131e-16]
RenderView1.CameraPosition = [41.5, 0.0, 56.5]
RenderView1.CameraClippingRange = [120.40716073726786,
126.85668499830999]
RenderView1.InteractionMode = '3D'
RenderView1.CameraFocalPoint = [0, 0, 56.5]
RenderView1.CenterOfRotation = [0, 0, 56.5]
#--- Export image
Render()
WriteImage('Q_cf_topview_'+index[i]+'.jpg')
#--- Delete objects (order is important)
Delete(DataSeparationLine)
Delete(separationline)
Delete(Cfcontours)
Delete(cf_VP_anim_xmf)
Delete(DataQiso)
Delete(ContourQ)
Delete(DataQ)
Delete(Q_VP_xmf)
At the end of the for loop, I delete all the objects and readers. I run
this python script in batch mode (Paraview 3.98) and in parallel with 4
processors. However I am having a memory leak, by the 6th time in the for
loop it complains about insufficient memory. Can anyone understand what is
causing the memory to increase? Do I forget to delete sth?
Thank you,
Nikos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130620/699c4284/attachment-0001.htm>
More information about the ParaView
mailing list