[vtkusers] Memory Leak

fladak at rri.on.ca fladak at rri.on.ca
Fri Feb 23 16:18:13 EST 2001


I was wondering if someone could help me out with a problem that I'm having with
a memory leak.

My application returns the gray scale value at a specified point within a volume
image.  Here is the code:

 ...
 polyVertexPoints = vtkFloatPoints()
 polyVertexPoints.SetNumberOfPoints(1)
 polyVertexPoints.InsertPoint(0,x1,y1,z1)

 aPolyVertex = vtkPolyVertex()
 aPolyVertex.GetPointIds().SetNumberOfIds(1)
 aPolyVertex.GetPointIds().SetId(0,0)

 Point = vtkUnstructuredGrid()
 Point.Allocate(1,1)
 Point.InsertNextCell(aPolyVertex.GetCellType(), aPolyVertex.GetPointIds())
 Point.SetPoints(polyVertexPoints)

 probe = vtkProbeFilter()
 probe.SetSource(self._reader.GetOutput())
 probe.SetInput(Point)
 probe.Update()

 GrayScaleValue = probe.GetOutput().GetPointData().GetScalars().GetScalar(0)
 ...

It seems that when I call this code repeatedly that there is a memory leak and
eventually the program crashess.

The memory leak occurs on the last line of code.
ie.
 GrayScaleValue = probe.GetOutput().GetPointData().GetScalars().GetScalar(0)

Does anyone know what I have to do to free up memory.  I have tried to use the
Delete() method but I get an "AttributeError" message.

I would appreciate any help.  Thanks.


-Faruq



---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/






More information about the vtkusers mailing list