<!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">

<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 20051202</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}&nbsp;</tt> 
</p>
</li>

            <ul>

   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>
   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>

            </ul>


    <li class="gap">
<p>
 <tt>gc-messages</tt> 
</p>
</li>

            <ul>

   Print a message at the start and end of every garbage collection. 
            </ul>


    <li class="gap">
<p>
 <tt>gc-summary</tt> 
</p>
</li>

            <ul>

   Print a summary of garbage collection statistics upon program termination. 
            </ul>


    <li class="gap">
<p>
 <tt>load-world&nbsp;</tt><em>world</em> 
</p>
</li>

            <ul>

   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>. 
            </ul>


    <li class="gap">
<p>
 <tt>max-heap&nbsp;</tt><em>x</em><tt>{k|K|m|M|g|G}&nbsp;</tt> 
</p>
</li>

            <ul>

   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>. 
            </ul>


    <li class="gap">
<p>
 <tt>no-load-world</tt> 
</p>
</li>

            <ul>

   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. 
            </ul>


    <li class="gap">
<p>
 <tt>ram-slop&nbsp;</tt><em>x</em> 
</p>
</li>

            <ul>

   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. 
            </ul>


    <li class="gap">
<p>
 <tt>stop</tt> 
</p>
</li>

            <ul>

   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. </ul>

</ul>

</div>



<p>
<hr>
Last edited on 2005-12-02 06:13:52 by <span title="ppp-71-139-183-221.dsl.snfc21.pacbell.net"><a href="StephenWeeks">StephenWeeks</a></span>.
</body></html>
