commit c19561bc509f9730aee1017b19f7f302c5fd0ece
parent 7c07e619f204552a8df0551a49f1b7817a196047
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 29 Mar 2016 17:00:59 +0200
Fix memleaks
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/s4vs.c b/src/s4vs.c
@@ -224,6 +224,11 @@ compute_4v_s(struct s3d_scene* scene, const size_t max_steps, const double ks)
for (i = 0; i < max_steps; i++) {
realization(rng, &ctx);
}
+ SSP(rng_ref_put(rng));
+#pragma omp single
+ {
+ SSP(rng_proxy_ref_put(proxy));
+ }
}
#else
/* single-threaded execution: create a single RNG */
@@ -231,6 +236,7 @@ compute_4v_s(struct s3d_scene* scene, const size_t max_steps, const double ks)
for (i = 0; i < max_steps; i++) {
realization(rng, &ctx);
}
+ SSP(rng_ref_put(rng));
#endif
time_current(&end);
@@ -267,6 +273,7 @@ exit:
int mask;
S3D(scene_get_session_mask(scene, &mask));
if(mask) S3D(scene_end_session(scene));
+ S3D(scene_ref_put(scene));
}
if(shape) S3D(shape_ref_put(shape));
@@ -362,5 +369,10 @@ int main(int argc, char *argv[]) {
}
}
- return compute_4v_s(scene, nsteps, ks);
+ compute_4v_s(scene, nsteps, ks);
+
+ /* check memory leaks */
+ CHECK(mem_allocated_size(), 0);
+
+ return 0;
}