fix memory leak for fix_dynamic(a.k.a. neigh/history)
This commit is contained in:
@ -75,6 +75,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
|
||||
maxexchange = maxexchange_atom = maxexchange_fix = 0;
|
||||
maxexchange_fix_dynamic = 0;
|
||||
bufextra = BUFEXTRA;
|
||||
bufextra_max = bufextra;
|
||||
|
||||
grid2proc = nullptr;
|
||||
xsplit = ysplit = zsplit = nullptr;
|
||||
|
||||
@ -140,6 +140,7 @@ class Comm : protected Pointers {
|
||||
int maxexchange_fix; // static contribution to maxexchange from Fixes
|
||||
int maxexchange_fix_dynamic; // 1 if a fix has a dynamic contribution
|
||||
int bufextra; // augment send buf size for an exchange atom
|
||||
int bufextra_max;
|
||||
|
||||
int gridflag; // option for creating 3d grid
|
||||
int mapflag; // option for mapping procs to 3d grid
|
||||
|
||||
@ -133,9 +133,11 @@ void CommBrick::init()
|
||||
{
|
||||
Comm::init();
|
||||
|
||||
int bufextra_old = bufextra;
|
||||
init_exchange();
|
||||
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,2);
|
||||
if (bufextra > bufextra_max) {
|
||||
grow_send(maxsend+bufextra,2);
|
||||
bufextra_max = bufextra;
|
||||
}
|
||||
|
||||
// memory for multi style communication
|
||||
// allocate in setup
|
||||
@ -672,9 +674,11 @@ void CommBrick::exchange()
|
||||
// only need to reset if a fix can dynamically add to size of single atom
|
||||
|
||||
if (maxexchange_fix_dynamic) {
|
||||
int bufextra_old = bufextra;
|
||||
init_exchange();
|
||||
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,2);
|
||||
if (bufextra > bufextra_max) {
|
||||
grow_send(maxsend+bufextra,2);
|
||||
bufextra_max = bufextra;
|
||||
}
|
||||
}
|
||||
|
||||
// subbox bounds for orthogonal or triclinic
|
||||
|
||||
@ -943,9 +943,11 @@ void CommTiled::exchange()
|
||||
// only need to reset if a fix can dynamically add to size of single atom
|
||||
|
||||
if (maxexchange_fix_dynamic) {
|
||||
int bufextra_old = bufextra;
|
||||
init_exchange();
|
||||
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,2);
|
||||
if (bufextra > bufextra_max) {
|
||||
grow_send(maxsend+bufextra,2);
|
||||
bufextra = bufextra_max;
|
||||
}
|
||||
}
|
||||
|
||||
// domain properties used in exchange method and methods it calls
|
||||
|
||||
Reference in New Issue
Block a user