fixed memory leaks

This commit is contained in:
papush! 2022-03-24 15:25:18 +01:00
parent 70afbbcdfc
commit 4e60a749e9
4 changed files with 6 additions and 1 deletions

View File

@ -72,6 +72,7 @@ vtkTypeBool DihedralAnglesFilter::RequestData(
i += 6; i += 6;
} }
it->Delete();
AverageMinDegrees /= input->GetNumberOfCells(); AverageMinDegrees /= input->GetNumberOfCells();
AverageMinDegrees = AverageMinDegrees * 180. / 3.141592653589793; AverageMinDegrees = AverageMinDegrees * 180. / 3.141592653589793;
MinMinDegrees = MinMinDegrees * 180. / 3.141592653589793; MinMinDegrees = MinMinDegrees * 180. / 3.141592653589793;

View File

@ -37,7 +37,7 @@
#include <array> #include <array>
vtkSmartPointer<vtkAlgorithm> readerFromFileName(const char *fileName) { vtkAlgorithm *readerFromFileName(const char *fileName) {
std::string extension = std::string extension =
vtksys::SystemTools::GetFilenameLastExtension(fileName); vtksys::SystemTools::GetFilenameLastExtension(fileName);
if (extension == ".vtk") { if (extension == ".vtk") {
@ -148,5 +148,7 @@ int main(int argc, char **argv) {
renderWindow->Render(); renderWindow->Render();
renderWindowInteractor->Start(); renderWindowInteractor->Start();
#endif #endif
tetMeshReader->Delete();
polyMeshReader->Delete();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -60,6 +60,7 @@ vtkTypeBool RemoveExternalCellsFilter::RequestData(
outCells->InsertNextCell(it->GetPointIds()); outCells->InsertNextCell(it->GetPointIds());
} }
} }
it->Delete();
output->SetCells(VTK_TETRA, outCells); output->SetCells(VTK_TETRA, outCells);
output->SetPoints(tetMesh->GetPoints()); output->SetPoints(tetMesh->GetPoints());

View File

@ -72,6 +72,7 @@ vtkTypeBool SurfacePointsFilter::RequestData(
} }
} }
} }
it->Delete();
surfacePoints->Allocate(surfacePointsSet.size()); surfacePoints->Allocate(surfacePointsSet.size());
for (const vtkIdType &id : surfacePointsSet) { for (const vtkIdType &id : surfacePointsSet) {
surfacePoints->InsertNextValue(id); surfacePoints->InsertNextValue(id);