From 5495ee6562bb24ad11946ebc0f68c0615ed3281b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5ivo=20Leedj=C3=A4rv?= Date: Fri, 25 Oct 2024 10:49:31 +0200 Subject: [PATCH] Print GC stats when server catches [Out_of_memory] --- src/main.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.ml b/src/main.ml index 46c64923b..129194643 100644 --- a/src/main.ml +++ b/src/main.ml @@ -162,7 +162,12 @@ let catch_all f = (* Util.msg "Done catch_all...\n"; *) with Prefs.IllegalValue str -> raise (Util.Fatal str) with e -> - Util.msg "Unison server failed: %s\n" (Uicommon.exn2string e); exit 1;; + Util.msg "Unison server failed: %s\n" (Uicommon.exn2string e); + (* A final desperate attempt to print out some debug information. + If we are really-really out of memory then this may fail but + then it's unlikely we reach this point anyway. *) + if e = Out_of_memory then Gc.print_stat stderr; + exit 1 let gui_safe_printf fmt = Printf.ksprintf (fun s ->