Skip to content

Commit ba49ccd

Browse files
committed
OCaml 5 memory blowup workaround
This commits try to workaround a memory blowup in Why3 by changing the `space_overhead` configuration of the GC before calling SMT solvers. This hack should be removed once the root cause has been found and fixed. Time impact is limited (< 1%).
1 parent 5480f45 commit ba49ccd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ecSmt.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,15 @@ let check ?notify (pi : P.prover_infos) (hyps : LDecl.hyps) (concl : form) =
17241724
Format.eprintf "dumping in %s" filename;
17251725
let filename = Printf.sprintf "%.4d-%s" tkid filename in
17261726
out_task filename task));
1727-
let (tp, res) = EcUtils.timed (P.execute_task ?notify pi) task in
1727+
let (tp, res) = EcUtils.timed (fun task ->
1728+
if Sys.ocaml_release.major = 5 then begin
1729+
let control = Gc.get () in
1730+
Gc.set { control with space_overhead = min 20 control.space_overhead; };
1731+
EcUtils.try_finally
1732+
(fun () -> P.execute_task ?notify pi task)
1733+
(fun () -> Gc.set control)
1734+
end else P.execute_task ?notify pi task
1735+
) task in
17281736

17291737
if 1 <= pi.P.pr_verbose then
17301738
notify |> oiter (fun notify -> notify `Warning (lazy (

0 commit comments

Comments
 (0)