Skip to content

Commit 3952606

Browse files
committed
Do not compute GC stats twice when printing memory statistics
1 parent 0df8511 commit 3952606

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ecTerminal.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ class from_channel
184184
| Some (mem, unu, btick) when btick > tick-20 ->
185185
(mem, unu)
186186
| _ ->
187-
let mem = (Gc.stat ()).Gc.live_words in
187+
let stats = Gc.stat () in
188+
let mem = stats.Gc.live_words in
188189
let mem = (float_of_int mem) *. (float_of_int (Sys.word_size / 8)) in
189-
let unu = (Gc.stat ()).Gc.fragments in
190+
let unu = stats.Gc.fragments in
190191
let unu = (float_of_int unu) *. (float_of_int (Sys.word_size / 8)) in
191192
gc <- Some (mem, unu, tick); (mem, unu)
192193
in

0 commit comments

Comments
 (0)