[Paraview] Memory leak with Python script (XDMF and HDF5)

Jason Fleming jason.fleming at seahorsecoastal.com
Fri Jun 21 10:20:30 EDT 2013


Hello Nikos

I have memory leak issues when creating animations from an XDMF file from
the Paraview GUI (version 3.14.1 32-bit). In my case, I was using a single
file XDMF file pair (i.e., one XML file and one HDF5 file) rather than a
series of XDMF files.

As a workaround, I use VTK to write a series of images and then make the
animation from those myself.

I wonder if there is a memory leak in the Paraview 3.x XDMF reader? I think
Kitware may have used a new version of the XDMF library in the recently
released Paraview 4.0 ... if so, then you might try Paraview 4.0 to see if
that fixes the issue.

Cheers
Jason



On Thu, Jun 20, 2013 at 11:15 AM, Nikolaos Beratlis <
nikos.beratlis at gmail.com> wrote:

> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>


-- 
Dr. Jason G. Fleming
Chief Engineer, Seahorse Coastal Consulting
3103 Mandy Ln
Morehead City, NC 28557
Tel: (252) 726-6323
Mobile: (252) 269-0962
Web: http://www.seahorsecoastal.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130621/b6cbbf5f/attachment.htm>


More information about the ParaView mailing list