Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / RunTimeOptions
CommitLineData
7f918cf1
CE
1<!DOCTYPE html>\r
2<html lang="en">\r
3<head>\r
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
5<meta name="generator" content="AsciiDoc 8.6.9">\r
6<title>RunTimeOptions</title>\r
7<link rel="stylesheet" href="./asciidoc.css" type="text/css">\r
8<link rel="stylesheet" href="./pygments.css" type="text/css">\r
9\r
10\r
11<script type="text/javascript" src="./asciidoc.js"></script>\r
12<script type="text/javascript">\r
13/*<![CDATA[*/\r
14asciidoc.install();\r
15/*]]>*/\r
16</script>\r
17<link rel="stylesheet" href="./mlton.css" type="text/css">\r
18</head>\r
19<body class="article">\r
20<div id="banner">\r
21<div id="banner-home">\r
22<a href="./Home">MLton 20180207</a>\r
23</div>\r
24</div>\r
25<div id="header">\r
26<h1>RunTimeOptions</h1>\r
27</div>\r
28<div id="content">\r
29<div id="preamble">\r
30<div class="sectionbody">\r
31<div class="paragraph"><p>Executables produced by MLton take command line arguments that control\r
32the runtime system. These arguments are optional, and occur before\r
33the executable&#8217;s usual arguments. To use these options, the first\r
34argument to the executable must be <span class="monospaced">@MLton</span>. The optional arguments\r
35then follow, must be terminated by <span class="monospaced">--</span>, and are followed by any\r
36arguments to the program. The optional arguments are <em>not</em> made\r
37available to the SML program via <span class="monospaced">CommandLine.arguments</span>. For\r
38example, a valid call to <span class="monospaced">hello-world</span> is:</p></div>\r
39<div class="listingblock">\r
40<div class="content monospaced">\r
41<pre>hello-world @MLton gc-summary fixed-heap 10k -- a b c</pre>\r
42</div></div>\r
43<div class="paragraph"><p>In the above example,\r
44<span class="monospaced">CommandLine.arguments () = ["a", "b", "c"]</span>.</p></div>\r
45<div class="paragraph"><p>It is allowed to have a sequence of <span class="monospaced">@MLton</span> arguments, as in:</p></div>\r
46<div class="listingblock">\r
47<div class="content monospaced">\r
48<pre>hello-world @MLton gc-summary -- @MLton fixed-heap 10k -- a b c</pre>\r
49</div></div>\r
50<div class="paragraph"><p>Run-time options can also control MLton, as in</p></div>\r
51<div class="listingblock">\r
52<div class="content monospaced">\r
53<pre>mlton @MLton fixed-heap 0.5g -- foo.sml</pre>\r
54</div></div>\r
55</div>\r
56</div>\r
57<div class="sect1">\r
58<h2 id="_options">Options</h2>\r
59<div class="sectionbody">\r
60<div class="ulist"><ul>\r
61<li>\r
62<p>\r
63<span class="monospaced">fixed-heap <em>x</em>{k|K|m|M|g|G}</span>\r
64</p>\r
65<div class="paragraph"><p>Use a fixed size heap of size <em>x</em>, where <em>x</em> is a real number and the\r
66trailing letter indicates its units.</p></div>\r
67<table class="tableblock frame-all grid-all"\r
68style="\r
69width:100%;\r
70">\r
71<col style="width:25%;">\r
72<col style="width:75%;">\r
73<tbody>\r
74<tr>\r
75<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">k</span> or <span class="monospaced">K</span></p></td>\r
76<td class="tableblock halign-left valign-top" ><p class="tableblock">1024</p></td>\r
77</tr>\r
78<tr>\r
79<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">m</span> or <span class="monospaced">M</span></p></td>\r
80<td class="tableblock halign-left valign-top" ><p class="tableblock">1,048,576</p></td>\r
81</tr>\r
82<tr>\r
83<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">g</span> or <span class="monospaced">G</span></p></td>\r
84<td class="tableblock halign-left valign-top" ><p class="tableblock">1,073,741,824</p></td>\r
85</tr>\r
86</tbody>\r
87</table>\r
88<div class="paragraph"><p>A value of <span class="monospaced">0</span> means to use almost all the RAM present on the machine.</p></div>\r
89<div class="paragraph"><p>The heap size used by <span class="monospaced">fixed-heap</span> includes all memory allocated by\r
90SML code, including memory for the stack (or stacks, if there are\r
91multiple threads). It does not, however, include any memory used for\r
92code itself or memory used by C globals, the C stack, or malloc.</p></div>\r
93</li>\r
94<li>\r
95<p>\r
96<span class="monospaced">gc-messages</span>\r
97</p>\r
98<div class="paragraph"><p>Print a message at the start and end of every garbage collection.</p></div>\r
99</li>\r
100<li>\r
101<p>\r
102<span class="monospaced">gc-summary</span>\r
103</p>\r
104<div class="paragraph"><p>Print a summary of garbage collection statistics upon program\r
105termination to standard error.</p></div>\r
106</li>\r
107<li>\r
108<p>\r
109<span class="monospaced">gc-summary-file <em>file</em></span>\r
110</p>\r
111<div class="paragraph"><p>Print a summary of garbage collection statistics upon program\r
112termination to the file specified by <em>file</em>.</p></div>\r
113</li>\r
114<li>\r
115<p>\r
116<span class="monospaced">load-world <em>world</em></span>\r
117</p>\r
118<div class="paragraph"><p>Restart the computation with the file specified by <em>world</em>, which must\r
119have been created by a call to <span class="monospaced">MLton.World.save</span> by the same\r
120executable. See <a href="MLtonWorld">MLtonWorld</a>.</p></div>\r
121</li>\r
122<li>\r
123<p>\r
124<span class="monospaced">max-heap <em>x</em>{k|K|m|M|g|G}</span>\r
125</p>\r
126<div class="paragraph"><p>Run the computation with an automatically resized heap that is never\r
127larger than <em>x</em>, where <em>x</em> is a real number and the trailing letter\r
128indicates the units as with <span class="monospaced">fixed-heap</span>. The heap size for\r
129<span class="monospaced">max-heap</span> is accounted for as with <span class="monospaced">fixed-heap</span>.</p></div>\r
130</li>\r
131<li>\r
132<p>\r
133<span class="monospaced">may-page-heap {false|true}</span>\r
134</p>\r
135<div class="paragraph"><p>Enable paging the heap to disk when unable to grow the heap to a\r
136desired size.</p></div>\r
137</li>\r
138<li>\r
139<p>\r
140<span class="monospaced">no-load-world</span>\r
141</p>\r
142<div class="paragraph"><p>Disable <span class="monospaced">load-world</span>. This can be used as an argument to the compiler\r
143via <span class="monospaced">-runtime no-load-world</span> to create executables that will not load\r
144a world. This may be useful to ensure that set-uid executables do not\r
145load some strange world.</p></div>\r
146</li>\r
147<li>\r
148<p>\r
149<span class="monospaced">ram-slop <em>x</em></span>\r
150</p>\r
151<div class="paragraph"><p>Multiply <em>x</em> by the amount of RAM on the machine to obtain what the\r
152runtime views as the amount of RAM it can use. Typically <em>x</em> is less\r
153than 1, and is used to account for space used by other programs\r
154running on the same machine.</p></div>\r
155</li>\r
156<li>\r
157<p>\r
158<span class="monospaced">stop</span>\r
159</p>\r
160<div class="paragraph"><p>Causes the runtime to stop processing <span class="monospaced">@MLton</span> arguments once the next\r
161<span class="monospaced">--</span> is reached. This can be used as an argument to the compiler via\r
162<span class="monospaced">-runtime stop</span> to create executables that don&#8217;t process any <span class="monospaced">@MLton</span>\r
163arguments.</p></div>\r
164</li>\r
165</ul></div>\r
166</div>\r
167</div>\r
168</div>\r
169<div id="footnotes"><hr></div>\r
170<div id="footer">\r
171<div id="footer-text">\r
172</div>\r
173<div id="footer-badges">\r
174</div>\r
175</div>\r
176</body>\r
177</html>\r