Fix memory leak
This commit is contained in:
@ -36,6 +36,7 @@ static constexpr int BUFEXTRA = 1000;
|
||||
|
||||
CommTiledKokkos::CommTiledKokkos(LAMMPS *_lmp) : CommTiled(_lmp)
|
||||
{
|
||||
sendlist = nullptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -47,6 +48,7 @@ CommTiledKokkos::CommTiledKokkos(LAMMPS *_lmp) : CommTiled(_lmp)
|
||||
|
||||
CommTiledKokkos::CommTiledKokkos(LAMMPS *_lmp, Comm *oldcomm) : CommTiled(_lmp,oldcomm)
|
||||
{
|
||||
sendlist = nullptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -57,7 +59,6 @@ CommTiledKokkos::~CommTiledKokkos()
|
||||
sendlist = nullptr;
|
||||
buf_send = nullptr;
|
||||
buf_recv = nullptr;
|
||||
maxswap = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -2468,8 +2468,10 @@ void CommTiled::deallocate_swap(int n)
|
||||
|
||||
delete [] maxsendlist[i];
|
||||
|
||||
for (int j = 0; j < nprocmax[i]; j++) memory->destroy(sendlist[i][j]);
|
||||
delete [] sendlist[i];
|
||||
if (sendlist && sendlist[i]) {
|
||||
for (int j = 0; j < nprocmax[i]; j++) memory->destroy(sendlist[i][j]);
|
||||
delete [] sendlist[i];
|
||||
}
|
||||
}
|
||||
|
||||
delete [] sendproc;
|
||||
|
||||
Reference in New Issue
Block a user