summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/gc.ml11
-rw-r--r--stdlib/gc.mli18
2 files changed, 23 insertions, 6 deletions
diff --git a/stdlib/gc.ml b/stdlib/gc.ml
index a62714569..c50dbaef4 100644
--- a/stdlib/gc.ml
+++ b/stdlib/gc.ml
@@ -27,7 +27,8 @@ type stat = {
free_blocks : int;
largest_free : int;
fragments : int;
- compactions : int
+ compactions : int;
+ top_heap_words : int;
};;
type control = {
@@ -36,7 +37,7 @@ type control = {
mutable space_overhead : int;
mutable verbose : int;
mutable max_overhead : int;
- mutable stack_limit : int
+ mutable stack_limit : int;
};;
external stat : unit -> stat = "gc_stat";;
@@ -59,6 +60,7 @@ let print_stat c =
fprintf c "major_collections: %d\n" st.major_collections;
fprintf c "heap_words: %d\n" st.heap_words;
fprintf c "heap_chunks: %d\n" st.heap_chunks;
+ fprintf c "top_heap_words: %d\n" st.top_heap_words;
fprintf c "live_words: %d\n" st.live_words;
fprintf c "live_blocks: %d\n" st.live_blocks;
fprintf c "free_words: %d\n" st.free_words;
@@ -76,9 +78,8 @@ let allocated_bytes () =
external finalise : ('a -> unit) -> 'a -> unit = "final_register";;
-type alarm_rec = {active : alarm; f : unit -> unit}
-and alarm = bool ref
-;;
+type alarm = bool ref;;
+type alarm_rec = {active : alarm; f : unit -> unit};;
let rec call_alarm arec =
if !(arec.active) then begin
diff --git a/stdlib/gc.mli b/stdlib/gc.mli
index 57c4e28c1..81b7be578 100644
--- a/stdlib/gc.mli
+++ b/stdlib/gc.mli
@@ -20,41 +20,57 @@ type stat =
(** Number of words allocated in the minor heap since
the program was started. This number is accurate in the
byte-code runtime, but only approximate in the native runtime. *)
+
promoted_words : float;
(** Number of words allocated in the minor heap that
survived a minor collection and were moved to the major heap
since the program was started. *)
+
major_words : float;
(** Number of words allocated in the major heap, including
the promoted words, since the program was started. *)
+
minor_collections : int;
(** Number of minor collections since the program was started. *)
+
major_collections : int;
(** Number of major collection cycles, not counting
the current cycle, since the program was started. *)
+
heap_words : int;
(** Total size of the major heap, in words. *)
+
heap_chunks : int;
(** Number of times the major heap size was increased
since the program was started (including the initial allocation
of the heap). *)
+
live_words : int;
(** Number of words of live data in the major heap, including the header
words. *)
+
live_blocks : int;
(** Number of live blocks in the major heap. *)
+
free_words : int;
(** Number of words in the free list. *)
+
free_blocks : int;
(** Number of blocks in the free list. *)
+
largest_free : int;
(** Size (in words) of the largest block in the free list. *)
+
fragments : int;
(** Number of wasted words due to fragmentation. These are
1-words free blocks placed between two live blocks. They
are not available for allocation. *)
+
compactions : int;
- (** Number of heap compactions since the program was started. *)
+ (** Number of heap compactions since the program was started. *)
+
+ top_heap_words : int;
+ (** Maximum size reached by the major heap, in words. *)
}
(** The memory management counters are returned in a [stat] record.