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
Use a fixed size heap of size x, where x is a real number and the trailing letter indicates its units.
k or K
m or M
g or G
A value of 0 means to use almost all the RAM present on the machine.
The heap size used by fixed-heap 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.
Print a message at the start and end of every garbage collection.
Print a summary of garbage collection statistics upon program termination.
Restart the computation with the file specified by world, which must have been created by a call to MLton.World.save by the same executable. See MLtonWorld.
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 for max-heap is accounted for as with fixed-heap.
Enable paging the heap to disk when unable to grow the heap to a desired size.
Disable load-world. This can be used as an argument to the compiler via -runtime no-load-world 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.
Multiply 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.
Causes the runtime to stop processing @MLton arguments once the next -- is reached. This can be used as an argument to the compiler via -runtime stop to create executables that don’t process any @MLton arguments.