Sfoglia il codice sorgente

[memory] set some hardcore GC values before compacting in memory inspection

see #8415
Simon Krajewski 6 anni fa
parent
commit
456434674e
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      src/context/memory.ml

+ 6 - 0
src/context/memory.ml

@@ -93,7 +93,13 @@ let size v =
 let get_memory_json (cs : CompilationServer.t) mreq =
 let get_memory_json (cs : CompilationServer.t) mreq =
 	begin match mreq with
 	begin match mreq with
 	| MCache ->
 	| MCache ->
+		let old_gc = Gc.get() in
+		Gc.set { old_gc with
+			Gc.max_overhead = 0;
+			Gc.space_overhead = 0
+		};
 		Gc.compact();
 		Gc.compact();
+		Gc.set old_gc;
 		let stat = Gc.quick_stat() in
 		let stat = Gc.quick_stat() in
 		let size = (float_of_int stat.Gc.heap_words) *. (float_of_int (Sys.word_size / 8)) in
 		let size = (float_of_int stat.Gc.heap_words) *. (float_of_int (Sys.word_size / 8)) in
 		let cache_mem = cs#get_pointers in
 		let cache_mem = cs#get_pointers in