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