Unstructured Grid files; out of memory
Randy Heiland
heiland at ncsa.uiuc.edu
Tue May 23 11:27:30 EDT 2000
This is sort of a merging of two recent postings - mine on deleting VTK objs in
Python and the "Reading Unstructured Grid File" post.
My scenario is the following:
In Python, I read in an Unstructured Grid file and then, in a loop, read in
time-dependent vector fields (via vtkDataObjectReader) and update the vector
field in the UG (and render). I'm currently experimenting with something like
the following:
sgReader = vtkStructuredGridReader()
...
sg = vortSGReader.GetOutput()
sgVectors = vtkVectors()
for count in range(1,200,1):
print '-------------------------------'
sgSolnReader = vtkDataObjectReader()
sgSolnReader.DebugOn()
fname='foo.' + str(count) + '.vtk'
print 'fname = ',fname
sgSolnReader.SetFileName(fname)
sgSolnReader.Update()
sgVectors.SetData(sgSolnReader.GetOutput().GetFieldData().GetArray(0))
sg.GetPointData().SetVectors(sgVectors)
del sgSolnReader
renWin.Render()
During the course of the loop, I get the following:
ERROR: In vtkFloatArray.cxx, line 214
vtkFloatArray (0x1208fa20): Cannot allocate memory
So, my questions are:
1) would this fall under the memory leak error that Will mentioned (I too am
reading binary data)?
2) should one in fact be required to delete VTK objects in this scenario?
3) there seems to be a "Delete" method for certain Tcl wrapped objects (e.g.,
vtkPoints, see addendum), but not for the Python wrapped ones. Is this just a
semantic issue and the "del obj" in Python replaces the "obj.Delete()"?
Version: nightly from ~Apr. 10
OS: IRIX 6.5
thanks for any insight,
--Randy
---------------------------------------
Tcl:
% vtkPoints pts
pts
% pts DebugOn
% pts Print
vtkPoints (0x100a6708)
Debug: On
Delete Method defined
Modified Time: 17
Reference Count: 1
Number Of Points: 0
Bounds:
Xmin,Xmax: (1e+38, -1e+38)
Ymin,Ymax: (1e+38, -1e+38)
Zmin,Zmax: (1e+38, -1e+38)
% pts Delete
Debug: In vtkObject.cxx, line 245
vtkPoints (0x100a6708): UnRegistered by NULL, ReferenceCount = 0
Debug: In vtkObject.cxx, line 109
vtkObject (0x100a6708): Destructing!
% pts Print
/usr/afsws/bin/pts: Unrecognized operation 'Print'; type '/usr/afsws/bin/pts
help' for list
child process exited abnormally
%
---------
Python:
>>> from libVTKCommonPython import *
>>> pts=vtkPoints()
>>> pts.DebugOn()
>>> pts.Print()
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: Print
>>> pts
vtkPoints (0x100e3848)
Debug: On
No Delete Method
Modified Time: 2
Reference Count: 1
Number Of Points: 0
Bounds:
Xmin,Xmax: (1e+38, -1e+38)
Ymin,Ymax: (1e+38, -1e+38)
Zmin,Zmax: (1e+38, -1e+38)
>>> del pts
>>> pts
Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: pts
>>>
(Notice the "No Delete Method" for the 'pts' obj)
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
More information about the vtkusers
mailing list