fix valgrind issues

This commit is contained in:
Steve Plimpton
2022-12-15 08:48:27 -07:00
parent 2446a7855e
commit 6b2b3765c2
3 changed files with 15 additions and 4 deletions

View File

@ -273,7 +273,7 @@ void ComputePropertyGrid::deallocate_grid()
delete grid2d;
delete grid3d;
memory->destroy2d_offset(vec2d, nylo_out, nxlo_out);
memory->destroy2d_offset(array2d, nylo_out, nxlo_out);
memory->destroy3d_offset_last(array2d, nylo_out, nxlo_out);
memory->destroy3d_offset(vec3d, nzlo_out, nylo_out, nxlo_out);
memory->destroy4d_offset_last(array3d, nzlo_out, nylo_out, nxlo_out);
}

View File

@ -466,6 +466,9 @@ DumpImage::~DumpImage()
memory->destroy(chooseghost);
memory->destroy(bufcopy);
memory->destroy(gbuf);
delete [] id_grid_compute;
delete [] id_grid_fix;
}
/* ---------------------------------------------------------------------- */

View File

@ -330,7 +330,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) :
grid_sample = allocate_one_grid();
grid_nfreq = allocate_one_grid();
if (aveflag == RUNNING || aveflag == WINDOW) grid_nfreq = allocate_one_grid();
if (aveflag == RUNNING || aveflag == WINDOW) grid_running = allocate_one_grid();
if (aveflag == WINDOW) {
grid_window = new GridData*[nwindow];
for (int i = 0; i < nwindow; i++)
@ -2045,13 +2045,21 @@ void FixAveGrid::reset_grid()
grid_window_previous[i] = clone_one_grid(grid_window[i]);
}
delete grid_sample;
delete grid_nfreq;
if (aveflag == RUNNING || aveflag == WINDOW) delete grid_running;
if (aveflag == WINDOW) {
for (int i = 0; i < nwindow; i++)
delete grid_window;
}
// allocate grid instance and grid data for new decomposition
allocate_grid();
grid_sample = allocate_one_grid();
grid_nfreq = allocate_one_grid();
if (aveflag == RUNNING || aveflag == WINDOW) grid_nfreq = allocate_one_grid();
if (aveflag == RUNNING || aveflag == WINDOW) grid_running = allocate_one_grid();
if (aveflag == WINDOW) {
grid_window = new GridData*[nwindow];
for (int i = 0; i < nwindow; i++)