[vtkusers] about memory leak due to vtkPolyData::update() and vtkPolyData::GetPointCells();

M.Salman at surrey.ac.uk M.Salman at surrey.ac.uk
Mon Mar 26 20:44:09 EDT 2007


Hello All,

I have serious memory leak problems in my code due to vtkPolyData::Update() and vtkPolyData::GetPointCells(); so much serious  that the memory goes to 2 GB and then the program crashes down. After perusing through various posts on the mailing list about memory leaks, I understand that VTK is free from memory leaks and it has been tested against purify.But,I do get memory leak problems. I have tested my code against visual leak detector which gives following diagnosis :


Leak Caused by : vtkPolyData::GetCellPoints()

WARNING: Visual Leak Detector detected memory leaks!
---------- Block 48179 at 0x013A81E0: 4 bytes ----------
  Call Stack:
    C:\VTK\src\Common\vtkCellLinks.cxx (68): vtkCellLinks::AllocateLinks
    C:\VTK\src\Common\vtkCellLinks.cxx (152): vtkCellLinks::BuildLinks
    C:\VTK\src\Common\vtkPolyData.cxx (993): vtkPolyData::BuildLinks
    C:\vtkProjects\main\code\coreEmbed.cpp (158): coreEmbed::recalcNormals ------------------->data->GetPointCells(pointID,CellNumber,cellIdArray);




LEak caused  by vtkPolyData::Update()



---------- Block 912 at 0x013A1790: 200 bytes ----------
  Call Stack:
    C:\VTK\src\Common\vtkObject.cxx (31): vtkObject::operator new
    C:\VTK\src\Common\vtkFloatArray.cxx (26): vtkFloatArray::New
    C:\VTK\src\Common\vtkDataArray.cxx (634): vtkDataArray::CreateDataArray
    C:\VTK\src\IO\vtkXMLReader.cxx (446): vtkXMLReader::CreateDataArray
    C:\VTK\src\IO\vtkXMLDataReader.cxx (167): vtkXMLDataReader::SetupOutputInformation
    C:\VTK\src\IO\vtkXMLUnstructuredDataReader.cxx (334): vtkXMLUnstructuredDataReader::SetupOutputInformation
    C:\VTK\src\IO\vtkXMLReader.cxx (434): vtkXMLReader::SetupOutputData
    C:\VTK\src\IO\vtkXMLDataReader.cxx (214): vtkXMLDataReader::SetupOutputData
    C:\VTK\src\IO\vtkXMLUnstructuredDataReader.cxx (370): vtkXMLUnstructuredDataReader::SetupOutputData
    C:\VTK\src\IO\vtkXMLPolyDataReader.cxx (197): vtkXMLPolyDataReader::SetupOutputData
    C:\VTK\src\IO\vtkXMLReader.cxx (379): vtkXMLReader::ReadXMLData
    C:\VTK\src\IO\vtkXMLUnstructuredDataReader.cxx (244): vtkXMLUnstructuredDataReader::ReadXMLData
    C:\VTK\src\IO\vtkXMLReader.cxx (329): vtkXMLReader::ExecuteData
    C:\VTK\src\Common\vtkSource.cxx (408): vtkSource::UpdateData
    C:\VTK\src\Common\vtkDataObject.cxx (352): vtkDataObject::UpdateData
    C:\VTK\src\Common\vtkDataObject.cxx (251): vtkDataObject::Update
    C:\vtkProjects\main\code\basic.cxx (96): main--------------------------------------------->data->Update();
    crtexe.c (338): mainCRTStartup
    



---------- Block 297 at 0x01399980: 3 bytes ----------
  Call Stack:
    C:\VTK\src\IO\vtkXMLDataElement.cxx (168): vtkXMLDataElement::SetAttribute
    C:\VTK\src\IO\vtkXMLDataElement.cxx (106): vtkXMLDataElement::ReadXMLAttributes
    C:\VTK\src\IO\vtkXMLDataParser.cxx (138): vtkXMLDataParser::StartElement
    C:\VTK\src\IO\vtkXMLParser.cxx (471): vtkXMLParserStartElement
    C:\VTK\src\Utilities\expat\xmlparse.c (1641): doContent
    C:\VTK\src\Utilities\expat\xmlparse.c (1331): contentProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (2669): doProlog
    C:\VTK\src\Utilities\expat\xmlparse.c (2505): prologProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (2494): prologInitProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (1133): XML_ParseBuffer
    C:\VTK\src\Utilities\expat\xmlparse.c (1122): XML_Parse
    C:\VTK\src\IO\vtkXMLParser.cxx (444): vtkXMLParser::ParseBuffer
    C:\VTK\src\IO\vtkXMLDataParser.cxx (327): vtkXMLDataParser::ParseBuffer
    C:\VTK\src\IO\vtkXMLParser.cxx (356): vtkXMLParser::ParseXML
    C:\VTK\src\IO\vtkXMLParser.cxx (226): vtkXMLParser::Parse
    C:\VTK\src\IO\vtkXMLDataParser.cxx (106): vtkXMLDataParser::Parse
    C:\VTK\src\IO\vtkXMLReader.cxx (260): vtkXMLReader::ExecuteInformation
    C:\VTK\src\Common\vtkSource.cxx (222): vtkSource::UpdateInformation
    C:\VTK\src\Common\vtkDataObject.cxx (259): vtkDataObject::UpdateInformation
    C:\VTK\src\Common\vtkDataObject.cxx (248): vtkDataObject::Update
    C:\vtkProjects\main\code\basic.cxx (92): main       -------------------------------------->AnotherData->Update();


---------- Block 337 at 0x0139ADC0: 10 bytes ----------
  Call Stack:
    C:\VTK\src\IO\vtkXMLDataElement.h (42): vtkXMLDataElement::SetName
    C:\VTK\src\IO\vtkXMLDataParser.cxx (135): vtkXMLDataParser::StartElement
    C:\VTK\src\IO\vtkXMLParser.cxx (471): vtkXMLParserStartElement
    C:\VTK\src\Utilities\expat\xmlparse.c (1641): doContent
    C:\VTK\src\Utilities\expat\xmlparse.c (1331): contentProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (1331): contentProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (2669): doProlog
    C:\VTK\src\Utilities\expat\xmlparse.c (2505): prologProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (2494): prologInitProcessor
    C:\VTK\src\Utilities\expat\xmlparse.c (1133): XML_ParseBuffer
    C:\VTK\src\Utilities\expat\xmlparse.c (1122): XML_Parse
    C:\VTK\src\IO\vtkXMLParser.cxx (444): vtkXMLParser::ParseBuffer
    C:\VTK\src\IO\vtkXMLDataParser.cxx (327): vtkXMLDataParser::ParseBuffer
    C:\VTK\src\IO\vtkXMLParser.cxx (356): vtkXMLParser::ParseXML
    C:\VTK\src\IO\vtkXMLParser.cxx (226): vtkXMLParser::Parse
    C:\VTK\src\IO\vtkXMLDataParser.cxx (106): vtkXMLDataParser::Parse
    C:\VTK\src\IO\vtkXMLReader.cxx (260): vtkXMLReader::ExecuteInformation
    C:\VTK\src\Common\vtkSource.cxx (222): vtkSource::UpdateInformation
    C:\VTK\src\Common\vtkDataObject.cxx (259): vtkDataObject::UpdateInformation
    C:\VTK\src\Common\vtkDataObject.cxx (248): vtkDataObject::Update
    C:\vtkProjects\main\code\basic.cxx (92): main ----------------------------------->AnotherData->Update();
 

I guess I am making some very basic and serious mistake in using update() and getpointcells().Could anybody point out the problem and (if possible) the solution to it ? 

Best Regards,


M.Salman 
University of Surrey,U.K.
                                                                                                     

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070327/288d0244/attachment.htm>


More information about the vtkusers mailing list