From 58b74c50c3b23a008e5e3f4f5bef3edaae1418e6 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 18 Oct 2017 17:00:53 -0400 Subject: fixed memory leak due to not emptying stack in the case where the cluster flip is accepted in the hybrid method --- lib/wolff_tools.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') 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); } -- cgit v1.2.3-70-g09d2