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 @MLton. The optional arguments
then follow, must be terminated by --, and are followed by any
arguments to the program. The optional arguments are not made
available to the SML program via CommandLine.arguments. For
example, a valid call to hello-world is:
hello-world @MLton gc-summary fixed-heap 10k -- a b c
In the above example,
CommandLine.arguments () = ["a", "b", "c"].
It is allowed to have a sequence of @MLton arguments, as in:
hello-world @MLton gc-summary -- @MLton fixed-heap 10k -- a b c
Run-time options can also control MLton, as in
mlton @MLton fixed-heap 0.5g -- foo.sml
Options
-
fixed-heap x{k|K|m|M|g|G}Use a fixed size heap of size x, where x is a real number and the trailing letter indicates its units.
korK1024
morM1,048,576
gorG1,073,741,824
A value of
0means to use almost all the RAM present on the machine.The heap size used by
fixed-heapincludes 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. -
gc-messagesPrint a message at the start and end of every garbage collection.
-
gc-summaryPrint a summary of garbage collection statistics upon program termination to standard error.
-
gc-summary-file filePrint a summary of garbage collection statistics upon program termination to the file specified by file.
-
load-world worldRestart the computation with the file specified by world, which must have been created by a call to
MLton.World.saveby the same executable. See MLtonWorld. -
max-heap x{k|K|m|M|g|G}Run the computation with an automatically resized heap that is never larger than x, where x is a real number and the trailing letter indicates the units as with
fixed-heap. The heap size formax-heapis accounted for as withfixed-heap. -
may-page-heap {false|true}Enable paging the heap to disk when unable to grow the heap to a desired size.
-
no-load-worldDisable
load-world. This can be used as an argument to the compiler via-runtime no-load-worldto create executables that will not load a world. This may be useful to ensure that set-uid executables do not load some strange world. -
ram-slop xMultiply x by the amount of RAM on the machine to obtain what the runtime views as the amount of RAM it can use. Typically x is less than 1, and is used to account for space used by other programs running on the same machine.
-
stopCauses the runtime to stop processing
@MLtonarguments once the next--is reached. This can be used as an argument to the compiler via-runtime stopto create executables that don’t process any@MLtonarguments.