<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="robots" content="index,nofollow">



<title>RunTimeOptions - MLton Standard ML Compiler (SML Compiler)</title>
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css">


<link rel="Start" href="Home">


</head>

<body lang="en" dir="ltr">

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-833377-1";
urchinTracker();
</script>
<table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%>
  <tr>
    <td style = "
		border: 0px;
		color: darkblue; 
		font-size: 150%;
		text-align: left;">
      <a class = mltona href="Home">MLton MLTONWIKIVERSION</a>
    <td style = "
		border: 0px;
		font-size: 150%;
		text-align: center;
		width: 50%;">
      RunTimeOptions
    <td style = "
		border: 0px;
		text-align: right;">
      <table cellspacing = 0 style = "border: 0px">
        <tr style = "vertical-align: middle;">
      </table>
  <tr style = "background-color: white;">
    <td colspan = 3
	style = "
		border: 0px;
		font-size:70%;
		text-align: right;">
      <a href = "Home">Home</a>
      &nbsp;<a href = "Index">Index</a>
      &nbsp;
</table>
<div id="content" lang="en" dir="ltr">
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 <tt>@MLton</tt>.  The optional arguments then follow, must be terminated by <tt>--</tt>, and are followed by any arguments to the program.  The optional arguments are <em>not</em> made available to the SML program via <tt>CommandLine.arguments</tt>.  For example, a valid call to <tt>hello-world</tt> is: 
<pre>hello-world @MLton gc-summary fixed-heap 10k -- a b c
</pre>In the above example,  <tt>CommandLine.arguments&nbsp;()&nbsp;=&nbsp;["a",&nbsp;"b",&nbsp;"c"]</tt>. <p>
It is allowed to have a sequence of <tt>@MLton</tt> arguments, as in: 
<pre>hello-world @MLton gc-summary -- @MLton fixed-heap 10k -- a b c
</pre>
</p>
<p>
Run-time options can also control MLton, as in 
<pre>mlton @MLton fixed-heap 0.5g -- foo.sml
</pre>
</p>
<h2 id="head-6bf5da9c080bee3a8142586c412aa39971137eee">Options</h2>

    <ul>

    <li>
<p>
 <tt>fixed-heap&nbsp;</tt><em>x</em><tt>{k|K|m|M|g|G}</tt>  <br>
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. 
<div>
<table>
 <tr>
<td>
 <tt>k</tt> or <tt>K</tt> </td>
<td>
 1024 </td>
</tr>
 <tr>
<td>
 <tt>m</tt> or <tt>M</tt> </td>
<td>
 1,048,576 </td>
</tr>
 <tr>
<td>
 <tt>g</tt> or <tt>G</tt> </td>
<td>
 1,073,741,824 </td>
</tr>
</table>
</div>
 A value of <tt>0</tt> means to use almost all the RAM present on the  machine. 
</p>
<p>
 The heap size used by <tt>fixed-heap</tt> 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>
</li>
    <li class="gap">
<p>
 <tt>gc-messages</tt>  <br>
Print a message at the start and end of every garbage collection. 
</p>
</li>
    <li class="gap">
<p>
 <tt>gc-summary</tt>  <br>
Print a summary of garbage collection statistics upon program termination. 
</p>
</li>
    <li class="gap">
<p>
 <tt>load-world&nbsp;</tt><em>world</em>  <br>
Restart the computation with the file specified by <em>world</em>, which  must have been created by a call to <tt>MLton.World.save</tt> by the  same executable.  See <a href="MLtonWorld">MLtonWorld</a>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>max-heap&nbsp;</tt><em>x</em><tt>{k|K|m|M|g|G}</tt>  <br>
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 <tt>fixed-heap</tt>.  The  heap size for <tt>max-heap</tt> is accounted for as with  <tt>fixed-heap</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>no-load-world</tt>  <br>
Disable <tt>load-world</tt>.  This can be used as an argument to the  compiler via <tt>-runtime&nbsp;no-load-world</tt> 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>
</li>
    <li class="gap">
<p>
 <tt>ram-slop&nbsp;</tt><em>x</em>  <br>
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>
</li>
    <li class="gap">
<p>
 <tt>stop</tt>  <br>
Causes the runtime to stop processing <tt>@MLton</tt> arguments once  the next <tt>--</tt> is reached.  This can be used as an argument to  the compiler via <tt>-runtime&nbsp;stop</tt> to create executables that don't  process any <tt>@MLton</tt> arguments. 
</p>
</li>
</ul>

</div>



<p>
<hr>
Last edited on 2007-08-23 04:01:26 by <span title="c-71-57-91-146.hsd1.il.comcast.net"><a href="MatthewFluet">MatthewFluet</a></span>.
</body></html>
