From 26b7e819746a6b36d0e22181f64549c503fe0481 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Wed, 8 May 2019 13:01:39 +0200 Subject: Function print_memory_stat: getting rid of a mutable. --- toplevel/coqtop.ml | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml index 22d293129e..2f2cebe074 100644 --- a/toplevel/coqtop.ml +++ b/toplevel/coqtop.ml @@ -30,23 +30,18 @@ let print_header () = Feedback.msg_notice (str "Welcome to Coq " ++ str ver ++ str " (" ++ str rev ++ str ")"); flush_all () -let memory_stat = ref false let print_memory_stat () = - begin (* -m|--memory from the command-line *) - if !memory_stat then - Feedback.msg_notice - (str "total heap size = " ++ int (CObj.heap_size_kb ()) ++ str " kbytes" ++ fnl ()); - end; - begin - (* operf-macro interface: - https://github.com/OCamlPro/operf-macro *) - try - let fn = Sys.getenv "OCAML_GC_STATS" in - let oc = open_out fn in - Gc.print_stat oc; - close_out oc - with _ -> () - end + (* -m|--memory from the command-line *) + Feedback.msg_notice + (str "total heap size = " ++ int (CObj.heap_size_kb ()) ++ str " kbytes" ++ fnl ()); + (* operf-macro interface: + https://github.com/OCamlPro/operf-macro *) + try + let fn = Sys.getenv "OCAML_GC_STATS" in + let oc = open_out fn in + Gc.print_stat oc; + close_out oc + with _ -> () let interp_set_option opt v old = let open Goptions in -- cgit v1.2.3