ComputationalPhysiology / simcardems

Simula Cardiac ElectroMechanics Solver
http://computationalphysiology.github.io/simcardems
GNU Lesser General Public License v2.1
11 stars 11 forks source link

Fix PETSc memory issue #181

Closed finsberg closed 1 year ago

finsberg commented 1 year ago

For some reason, memory usage started accumulating after introducing the new interpolate function. It seems to be related to PETSc vectors not being automatically freed from memory. In this PR we make sure this is done by manually calling .destroy on the generated vectors.

Before patch https://github.com/ComputationalPhysiology/simcardems/assets/2010323/6feefabe-1983-4f92-81d9-8bed6aca20e7

After patch https://github.com/ComputationalPhysiology/simcardems/assets/2010323/de0cd3a1-83aa-496c-9e5d-360ced8427be

jorgensd commented 1 year ago

To add context, this is due to https://gitlab.com/petsc/petsc/-/issues/1309

Calling destroy or PETSc.garbage_cleanup() is the right fix