Bladeren bron

GC fix in Context.signature

Nicolas Cannasse 11 jaren geleden
bovenliggende
commit
0e02a748bf
1 gewijzigde bestanden met toevoegingen van 3 en 0 verwijderingen
  1. 3 0
      interp.ml

+ 3 - 0
interp.ml

@@ -2273,6 +2273,9 @@ let macro_lib =
 				| VClosure (vl,f) ->
 				| VClosure (vl,f) ->
 					let rl = ref [] in
 					let rl = ref [] in
 					let v2 = VClosure (Obj.magic rl, Obj.magic !cache_count) in
 					let v2 = VClosure (Obj.magic rl, Obj.magic !cache_count) in
+					(* in ocaml 4.0+ it was reported some stack overflow, related to vl being GC'ed or mutated in do_cache.
+					   let's make sure to have a real pointer to it first. The fix will trigger an alloc which might have simply moved the problem away *)
+					let vl = VNull :: vl in
 					do_cache v v2;
 					do_cache v v2;
 					rl := List.map loop vl;
 					rl := List.map loop vl;
 					v2
 					v2