Browsing through the SICStus Prolog User's Manual I stumbled upon the Prolog flag gc_tracing
.
I wanted to know more, so I started at the "Book Index" and found 3 entries for gc_trace
:
G
gc_trace (prolog flag): ref-lps-flg (#1: "4.9.4 Prolog Flags")
gc_trace (prolog flag): ref-mgc-egc (#2: "4.10.3 Enabling and Disabling the Garbage Collector")
gc_trace (prolog flag): ref-mgc-mgc (#3: "4.10.4 Monitoring Garbage Collections")
When I followed the links, I found the following:
4.9.4 Prolog Flags
gc_trace
Governs global stack garbage collection trace messages.
verbose Turn on verbose tracing of garbage collection.
terse Turn on terse tracing of garbage collection.
off Turn off tracing of garbage collection (the default).4.10.3 Enabling and Disabling the Garbage Collector
[...] To monitor garbage collections in verbose mode, set the gc_trace flag to verbose. [...]
4.10.4 Monitoring Garbage Collections
By default, the user is given no indication that the garbage collector is operating. If no program ever runs out of space and no program using a lot of global stack space requires an inordinate amount of processing time, then such information is unlikely to be needed.
However, if a program thought to be using much global stack space runs out of space or runs inordinately slowly, then the user may want to determine whether more or less frequent garbage collections are necessary. Information obtained from the garbage collector by turning on the gc_trace Prolog flag can be helpful in this determination.
On the spectrum "off - terse - verbose", I'd say: Terse! Haha, only serious:)
Finally, without any further ado, here is my actual question:
Given the verbosity flags of the OCaml garbage collector, find suitable combinations corresponding to the SICStus Prolog GC verbosity levels "off", "terse", and "verbose".
From the OCaml User's Manual:
Module GC
mutable verbose : int;
This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:
0x001
Start of major GC cycle.
0x002
Minor collection and major GC slice.
0x004
Growing and shrinking of the heap.
0x008
Resizing of stacks and memory manager tables.
0x010
Heap compaction.
0x020
Change of GC parameters.
0x040
Computation of major GC slice size.
0x080
Calling of finalisation functions.
0x100
Bytecode executable and shared library search at start-up.
0x200
Computation of compaction-triggering condition.
0x400
Output GC statistics at program exit. Default:0
.
end_of_file
The terse
value prints just a brief indication that a GC is about to happen. The verbose
value prints more details about the GC. The details are undocumented and subject to change, i.e. they are for human consumption.
The SICStus GC does have something akin to "minor" and "major" collections but the verbose
output is the same for both minor and full collection.
When memory areas change size is not a "garbage collection", as such, and there is currently no way to get indication when this happens (except after the fact, by calling statistics
).
I do not know the OCaml memory manager, but I guess that the non-off
value corresponds mostly to the first two ("Start of major GC cycle" and "Minor collection and major GC slice.") OCaml flags.