Memory taken by variables in
src/USER-SPH/atom_vec_meso.[cpp|h]
is not released in Atom::~Atom()
With this configuration file (in.meso):
atom_style meso
region box block 0 10 0 10 0 10 units box
create_box 1 box
create_atoms 1 single 5 5 5 units box
valgrind --leak-check=full <lmp> -in in.meso
reports several leaks like:
==13260== 8 bytes in 1 blocks are definitely lost in loss record 1 of 7
==13260== at 0x4C284F4: realloc (in
/scratch/netbsd/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13260== by 0x4C01D3: LAMMPS_NS::Memory::srealloc(void*, long,
char const*) (memory.cpp:61)
==13260== by 0x416F70: double*
LAMMPS_NS::Memory::grow<double>(double*&, int, char const*)
(memory.h:75)
==13260== by 0x6B85E9: LAMMPS_NS::AtomVecMeso::grow(int)
(atom_vec_meso.cpp:71)
==13260== by 0x4781AE: LAMMPS_NS::CreateBox::command(int, char**)
(create_box.cpp:174)
==13260== by 0x556422: void
LAMMPS_NS::Input::command_creator<LAMMPS_NS::CreateBox>(LAMMPS_NS::LAMMPS*,
int, char**) (input.cpp:631)
==13260== by 0x551AA4: LAMMPS_NS::Input::execute_command() (input.cpp:614)
==13260== by 0x54FF5A: LAMMPS_NS::Input::file() (input.cpp:225)
==13260== by 0x69C94C: main (main.cpp:31)
A patch bellow fixes it
diff --git a/src/atom.cpp b/src/atom.cpp
index cb394e4..0658d50 100644
--- a/src/atom.cpp
+++ b/src/atom.cpp
@@ -250,6 +250,13 @@ Atom::~Atom()
memory->destroy(improper_atom3);
memory->destroy(improper_atom4);
+ memory->destroy(rho);
+ memory->destroy(drho);
+ memory->destroy(e);
+ memory->destroy(de);
+ memory->destroy(vest);
+ memory->destroy(cv);
in.meso (119 Bytes)
0001-destroy-memory-for-SPH-variables-see-src-USER-SPH-at.patch (784 Bytes)
in.meso.valgrind.log (6.22 KB)