diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-10-18 17:00:53 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-10-18 17:00:53 -0400 |
commit | 58b74c50c3b23a008e5e3f4f5bef3edaae1418e6 (patch) | |
tree | eb2a6ed1c796004aae1885a9575bee7a9175f9fe | |
parent | 1e8779cbc8d9497b6622f93fd52dd3b918967a6e (diff) | |
download | c++-58b74c50c3b23a008e5e3f4f5bef3edaae1418e6.tar.gz c++-58b74c50c3b23a008e5e3f4f5bef3edaae1418e6.tar.bz2 c++-58b74c50c3b23a008e5e3f4f5bef3edaae1418e6.zip |
fixed memory leak due to not emptying stack in the case where the cluster flip is accepted in the hybrid method
-rw-r--r-- | lib/wolff_tools.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/wolff_tools.c b/lib/wolff_tools.c index 6b1e006..bab0908 100644 --- a/lib/wolff_tools.c +++ b/lib/wolff_tools.c @@ -206,6 +206,9 @@ uint32_t wolff_step(double T, double H, ising_state_t *s, sim_t sim, gsl_rng *r, s->spins[v] = !s->spins[v]; } } else { + while (c->spins != NULL) { + stack_pop(&(c->spins)); + } s->M += - sign(H) * 2 * c->dHb; s->H += 2 * (c->dJb + sign (H) * H * c->dHb); } |