SICStus Prolog 垃圾收集跟踪消息

SICStus Prolog garbage collection trace messages

浏览 SICStus Prolog User's Manual 我偶然发现了 Prolog 标志 gc_tracing

我想了解更多,所以我从 "Book Index" 开始,找到 gc_trace 的 3 个条目:

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")

当我点击链接时,我发现了以下内容:

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.

关于“关闭-简洁-冗长”,我会说:简洁!哈哈,只是认真的:)

最后,事不宜迟,这是我的实际问题:

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

terse 值仅打印一个 GC 即将发生的简短指示。 verbose 值打印有关 GC 的更多详细信息。详细信息未记录且可能会更改,即它们供人类使用。

SICStus GC 确实有类似于 "minor" 和 "major" 集合的东西,但是 verbose 输出对于次要集合和完整集合是相同的。

当内存区域更改大小时不是 "garbage collection",因此,目前无法在发生这种情况时获得指示(除非事后通过调用 statistics)。

我不知道 OCaml 内存管理器,但我猜非 off 值主要对应于前两个("Start of major GC cycle" 和 "Minor collection and major GC slice.")OCaml 标志。