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