fix a small memory leak in SHAKE setup

This commit is contained in:
Steve Plimpton 2018-12-19 17:40:35 -07:00 committed by Axel Kohlmeyer
parent b370a61b60
commit 981f12ebeb
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 8 additions and 5 deletions

View File

@ -955,7 +955,7 @@ void FixShake::find_clusters()
// -----------------------------------------------------
// set shake_flag,shake_atom,shake_type for non-central atoms
// requires communication for off-proc atoms
// requires rendezvous communication for off-proc atoms
// -----------------------------------------------------
shake_info(npartner,partner_tag,partner_shake);
@ -964,6 +964,9 @@ void FixShake::find_clusters()
// free local memory
// -----------------------------------------------------
memory->destroy(atomIDs);
memory->destroy(procowner);
memory->destroy(npartner);
memory->destroy(nshake);
memory->destroy(partner_tag);
@ -1390,24 +1393,24 @@ int FixShake::rendezvous_ids(int n, char *inbuf,
FixShake *fsptr = (FixShake *) ptr;
Memory *memory = fsptr->memory;
int *procowner;
tagint *atomIDs;
int *procowner;
memory->create(procowner,n,"special:procowner");
memory->create(atomIDs,n,"special:atomIDs");
memory->create(procowner,n,"special:procowner");
IDRvous *in = (IDRvous *) inbuf;
for (int i = 0; i < n; i++) {
procowner[i] = in[i].me;
atomIDs[i] = in[i].atomID;
procowner[i] = in[i].me;
}
// store rendezvous data in FixShake class
fsptr->nrvous = n;
fsptr->procowner = procowner;
fsptr->atomIDs = atomIDs;
fsptr->procowner = procowner;
// flag = 0: no 2nd irregular comm needed in comm->rendezvous