Commit fd813085 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

fix a small memory leak in SHAKE setup

parent e538fd5c
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -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