Fix for memory leak in NekMesh/OutputVtk.cpp
Issue/feature addressed
The instantiated VTK pointers (vtkUnstructuredGrid *vtkMesh, vtkPoints *vtkPoints, vtkUnstructuredGridWriter *vtkMeshWriter) were not deleted inside OutputVtk.cpp as it is suggested in https://vtk.org/Wiki/VTK/Tutorials/SmartPointers, so this caused a memory leak issue.
Proposed solution
The VTK simple pointers were replaced with VTK smart pointers so that by the end of execution, their deletion will be taken care of by the VTKSmartPointer class.
Implementation
ex. previously:
vtkObject* MyObject = vtkObject::New();
now:
vtkSmartPointer<vtkObject> MyObject = vtkSmartPointer<vtkObject>::New();
Tests
Notes
Checklist
-
Functions and classes, or changes to them, are documented. -
User guide/documentation is updated. -
Changelog is updated. -
Suitable tests added for new functionality. -
Contributed code is correctly formatted. (See the contributing guidelines). -
License added to any new files. -
No extraneous files have been added (e.g. compiler output or test data files).
Warning
On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master
branch. To resolve these conflicts , see
#295 (closed)