Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / MLtonGC.adoc
CommitLineData
7f918cf1
CE
1MLtonGC
2=======
3
4[source,sml]
5----
6signature MLTON_GC =
7 sig
8 val collect: unit -> unit
9 val pack: unit -> unit
10 val setMessages: bool -> unit
11 val setSummary: bool -> unit
12 val unpack: unit -> unit
13 structure Statistics :
14 sig
15 val bytesAllocated: unit -> IntInf.int
16 val lastBytesLive: unit -> IntInf.int
17 val numCopyingGCs: unit -> IntInf.int
18 val numMarkCompactGCs: unit -> IntInf.int
19 val numMinorGCs: unit -> IntInf.int
20 val maxBytesLive: unit -> IntInf.int
21 end
22 end
23----
24
25* `collect ()`
26+
27causes a garbage collection to occur.
28
29* `pack ()`
30+
31shrinks the heap as much as possible so that other processes can use
32available RAM.
33
34* `setMessages b`
35+
36controls whether diagnostic messages are printed at the beginning and
37end of each garbage collection. It is the same as the `gc-messages`
38runtime system option.
39
40* `setSummary b`
41+
42controls whether a summary of garbage collection statistics is printed
43upon termination of the program. It is the same as the `gc-summary`
44runtime system option.
45
46* `unpack ()`
47+
48resizes a packed heap to the size desired by the runtime.
49
50* `Statistics.bytesAllocated ()`
51+
52returns bytes allocated (as of the most recent garbage collection).
53
54* `Statistics.lastBytesLive ()`
55+
56returns bytes live (as of the most recent garbage collection).
57
58* `Statistics.numCopyingGCs ()`
59+
60returns number of (major) copying garbage collections performed (as of
61the most recent garbage collection).
62
63* `Statistics.numMarkCompactGCs ()`
64+
65returns number of (major) mark-compact garbage collections performed
66(as of the most recent garbage collection).
67
68* `Statistics.numMinorGCs ()`
69+
70returns number of minor garbage collections performed (as of the most
71recent garbage collection).
72
73* `Statistics.maxBytesLive ()`
74+
75returns maximum bytes live (as of the most recent garbage collection).