Go to the first, previous, next, last section, table of contents.

Controlling the run-time behaviour of your programs

To make an executable program, the GHC system compiles your code and then links it with a non-trivial runtime system (RTS), which handles storage management, profiling, etc.

You have some control over the behaviour of the RTS, by giving special command-line arguments to your program.

When your Haskell program starts up, its RTS extracts command-line arguments bracketed between `+RTS' and `-RTS' as its own. For example:

% ./a.out -f +RTS -pT -S -RTS -h foo bar
The RTS will snaffle `-pT -S' for itself, and the remaining arguments `-f -h foo bar' will be handed to your program if/when it calls `System.getArgs'.

No `-RTS' option is required if the runtime-system options extend to the end of the command line, as in this example:

% hls -ltr /usr/etc +RTS -H5m
If you absolutely positively want all the rest of the options in a command line to go to the program (and not the RTS), use a `--RTS'.

As always, for RTS options that take `<size>'s: If the last character of `size' is a K or k, multiply by 1000; if an M or m, by 1,000,000; if a G or G, by 1,000,000,000. (And any wraparound in the counters is your fault!)

Giving a `+RTS -f' option will print out the RTS options actually available in your program (which vary, depending on how you compiled).


Go to the first, previous, next, last section, table of contents.