Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | MLtonGC |
2 | ======= | |
3 | ||
4 | [source,sml] | |
5 | ---- | |
6 | signature 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 | + | |
27 | causes a garbage collection to occur. | |
28 | ||
29 | * `pack ()` | |
30 | + | |
31 | shrinks the heap as much as possible so that other processes can use | |
32 | available RAM. | |
33 | ||
34 | * `setMessages b` | |
35 | + | |
36 | controls whether diagnostic messages are printed at the beginning and | |
37 | end of each garbage collection. It is the same as the `gc-messages` | |
38 | runtime system option. | |
39 | ||
40 | * `setSummary b` | |
41 | + | |
42 | controls whether a summary of garbage collection statistics is printed | |
43 | upon termination of the program. It is the same as the `gc-summary` | |
44 | runtime system option. | |
45 | ||
46 | * `unpack ()` | |
47 | + | |
48 | resizes a packed heap to the size desired by the runtime. | |
49 | ||
50 | * `Statistics.bytesAllocated ()` | |
51 | + | |
52 | returns bytes allocated (as of the most recent garbage collection). | |
53 | ||
54 | * `Statistics.lastBytesLive ()` | |
55 | + | |
56 | returns bytes live (as of the most recent garbage collection). | |
57 | ||
58 | * `Statistics.numCopyingGCs ()` | |
59 | + | |
60 | returns number of (major) copying garbage collections performed (as of | |
61 | the most recent garbage collection). | |
62 | ||
63 | * `Statistics.numMarkCompactGCs ()` | |
64 | + | |
65 | returns number of (major) mark-compact garbage collections performed | |
66 | (as of the most recent garbage collection). | |
67 | ||
68 | * `Statistics.numMinorGCs ()` | |
69 | + | |
70 | returns number of minor garbage collections performed (as of the most | |
71 | recent garbage collection). | |
72 | ||
73 | * `Statistics.maxBytesLive ()` | |
74 | + | |
75 | returns maximum bytes live (as of the most recent garbage collection). |