[Insight-developers] Memory leak question.
Mark Foskey
mark_foskey at unc . edu
Tue, 10 Jun 2003 10:58:48 -0400
I'm getting the following memory leak message from Purify off the
dashboard. I'm including relevant lines of code so that you can see
what's going on:
----------------------------------
[W] MLK: Memory leak of 20 bytes from 1 block allocated in
itk::CellBoundary::itk,VectorContainer::itk>::itk,set::std,allocator::std>::std>::itk>::itk>::itk>::AddUsingCell(D
Distribution of leaked blocks
20 bytes from 1 block of 20 bytes (0x05aa2c60)
Allocation location
std::_Tree::std,allocator::std>::std,less::std,allocator::std>::_Insert(_Node::_Tree::std,allocator::std>::std,less::std,allocator::
[xtree:462]
itk::CellBoundary::itk,VectorContainer::itk>::itk,set::std,allocator::std>::std>::itk>::itk>::itk>::AddUsingCell(D
[itkCellBoundary.txx:44]
void
CellBoundary<TCell>
::AddUsingCell(CellIdentifier cellId)
{
m_UsingCells.insert(cellId); // cellID is an unsigned long
}
itk::AutomaticTopologyMeshSource::itk>::itk>::AddHexahedron(Array::itk
const&) [itkAutomaticTopologyMeshSource.txx:672]
: boundaryFeature->AddUsingCell( cellID );
itk::AutomaticTopologyMeshSource::itk>::itk>::AddHexahedron(DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD)
[itkAutomaticTopologyMeshSource.txx:777]
: return AddHexahedron( pointIDs );
: // pointIDs is an itk::Array of unsigned longs
itkAutomaticTopologyMeshSourceTest(int,char * * const)
[itkAutomaticTopologyMeshSourceTest.cxx:165]
main [itkTestMain.h:127]
mainCRTStartup [chkstk.obj]
-------------------------------------------
From the purify report, it looks like the allocation is happening
inside the xtree standard library code, which is part of the
implementation of std::set. I believe there have been problems with
Purify detecting spurious memory leaks with at least some versions of
the STL, and it certainly looks to me like that's what's happening
here. Is there something obvious that I'm missing, or, if not, is
there a standard way to keep these Purify errors from appearing?
--
Mark Foskey (919) 843-5436 Computer-Aided Diagnosis and Display Lab
mark_foskey at unc . edu Department of Radiology, CB 7515, UNC
http://www . cs . unc . edu/~foskey Chapel Hill, NC 27599-7515