diff --git a/include/viennals/lsOxidation.hpp b/include/viennals/lsOxidation.hpp index 436820d3..ce29cb45 100644 --- a/include/viennals/lsOxidation.hpp +++ b/include/viennals/lsOxidation.hpp @@ -196,6 +196,15 @@ template class Oxidation { Oxidation() = default; + ~Oxidation() { + // Break the shared_ptr cycle between + // OxidationDeformation::maskVelocityField and + // OxidationMaskBending::deformationField so both reach ref-count 0 when the + // SmartPointer members are destroyed in reverse declaration order. + if (deformationField) + deformationField->clearMaskVelocityField(); + } + Oxidation(SmartPointer> passedSiInterface, SmartPointer> passedAmbientInterface, SmartPointer> passedMaskInterface = nullptr) @@ -381,6 +390,13 @@ template class Oxidation { auto stepDeformationParams = deformationParams; stepDeformationParams.stressTimeStep = stressTimeStep; + // Break the shared_ptr cycle (OxidationDeformation ↔ + // OxidationMaskBending) left by the previous solveFields call so the old + // objects are freed when deformationField and maskBendingField are + // replaced below. + if (deformationField) + deformationField->clearMaskVelocityField(); + // --- Coupled diffusion + deformation solve --- diffusionField = OxidationDiffusion::New( diff --git a/include/viennals/lsWriteVisualizationMesh.hpp b/include/viennals/lsWriteVisualizationMesh.hpp index 823e90cc..a8ce7ab4 100644 --- a/include/viennals/lsWriteVisualizationMesh.hpp +++ b/include/viennals/lsWriteVisualizationMesh.hpp @@ -98,7 +98,7 @@ template class WriteVisualizationMesh { vtkSmartPointer newCells = vtkSmartPointer::New(); - vtkSmartPointer cellPoints = vtkIdList::New(); + vtkSmartPointer cellPoints = vtkSmartPointer::New(); oldCells->InitTraversal(); while (oldCells->GetNextCell(cellPoints)) { for (vtkIdType pointId = 0; pointId < cellPoints->GetNumberOfIds(); diff --git a/tests/MultiSurfaceMesh/CMakeLists.txt b/tests/MultiSurfaceMesh/CMakeLists.txt index da7605ca..166e02ed 100644 --- a/tests/MultiSurfaceMesh/CMakeLists.txt +++ b/tests/MultiSurfaceMesh/CMakeLists.txt @@ -5,3 +5,9 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ViennaLS) add_dependencies(ViennaLS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) +if(VIENNALS_ENABLE_SANITIZER) + set_tests_properties( + ${PROJECT_NAME} + PROPERTIES ENVIRONMENT + "LSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/tests/lsan_suppressions.txt") +endif() diff --git a/tests/VisualizationMesh/CMakeLists.txt b/tests/VisualizationMesh/CMakeLists.txt index e971f977..efec6b31 100644 --- a/tests/VisualizationMesh/CMakeLists.txt +++ b/tests/VisualizationMesh/CMakeLists.txt @@ -5,3 +5,9 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ViennaLS) add_dependencies(ViennaLS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) +if(VIENNALS_ENABLE_SANITIZER) + set_tests_properties( + ${PROJECT_NAME} + PROPERTIES ENVIRONMENT + "LSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/tests/lsan_suppressions.txt") +endif() diff --git a/tests/lsan_suppressions.txt b/tests/lsan_suppressions.txt new file mode 100644 index 00000000..32ff2e84 --- /dev/null +++ b/tests/lsan_suppressions.txt @@ -0,0 +1,4 @@ +# VTK 9.1 internal leak in geometry filter characterization (unfixed upstream) +leak:vtkGeometryFilterHelper::CharacterizeUnstructuredGrid +# OpenMP thread pool initialization — false positive under musl libc +leak:libgomp