man-pages/man1/ocamlrun.1.html
2021-03-31 01:06:50 +01:00

374 lines
9.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of OCAMLRUN</TITLE>
</HEAD><BODY>
<H1>OCAMLRUN</H1>
Section: User Commands (1)<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ocamlrun - The OCaml bytecode interpreter
<P>
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>ocamlrun</B>
[
<I>options</I>
]
<I>filename argument ...</I>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B><A HREF="/cgi-bin/man/man2html?1+ocamlrun">ocamlrun</A></B>(1)
command executes bytecode files produced by the
linking phase of the
<B><A HREF="/cgi-bin/man/man2html?1+ocamlc">ocamlc</A></B>(1)
command.
<P>
The first non-option argument is taken to be the name of the file
containing the executable bytecode. (That file is searched in the
executable path as well as in the current directory.) The remaining
arguments are passed to the OCaml program, in the string array
<B>Sys.argv</B>.
Element 0 of this array is the name of the
bytecode executable file; elements 1 to
<I>n</I>
are the remaining arguments.
<P>
In most cases, the bytecode
executable files produced by the
<B><A HREF="/cgi-bin/man/man2html?1+ocamlc">ocamlc</A></B>(1)
command are self-executable,
and manage to launch the
<B><A HREF="/cgi-bin/man/man2html?1+ocamlrun">ocamlrun</A></B>(1)
command on themselves automatically.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
The following command-line options are recognized by
<B><A HREF="/cgi-bin/man/man2html?1+ocamlrun">ocamlrun</A></B>(1).
<DL COMPACT>
<DT id="1"><B>-b</B>
<DD>
When the program aborts due to an uncaught exception, print a detailed
&quot;back trace&quot; of the execution, showing where the exception was
raised and which function calls were outstanding at this point. The
back trace is printed only if the bytecode executable contains
debugging information, i.e. was compiled and linked with the
<B>-g</B>
option to
<B><A HREF="/cgi-bin/man/man2html?1+ocamlc">ocamlc</A></B>(1)
set. This option is equivalent to setting the
<B>b</B>
flag in the OCAMLRUNPARAM environment variable (see below).
<DT id="2"><B>-I</B><I>&nbsp;dir</I>
<DD>
Search the directory
<I>dir</I>
for dynamically-loaded libraries, in addition to the standard search path.
<DT id="3"><B>-p</B>
<DD>
Print the names of the primitives known to this version of
<B><A HREF="/cgi-bin/man/man2html?1+ocamlrun">ocamlrun</A></B>(1)
and exit.
<DT id="4"><B>-v</B>
<DD>
Direct the memory manager to print verbose messages on standard error.
This is equivalent to setting
<B>v=63</B>
in the OCAMLRUNPARAM environment variable (see below).
<DT id="5"><B>-version</B>
<DD>
Print version string and exit.
<DT id="6"><B>-vnum</B>
<DD>
Print short version number and exit.
<P>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>ENVIRONMENT VARIABLES</H2>
<P>
The following environment variable are also consulted:
<DL COMPACT>
<DT id="7"><B>CAML_LD_LIBRARY_PATH</B>
<DD>
Additional directories to search for dynamically-loaded libraries.
<DT id="8"><B>OCAMLLIB</B>
<DD>
The directory containing the OCaml standard
library. (If
<B>OCAMLLIB</B>
is not set,
<B>CAMLLIB</B>
will be used instead.) Used to locate the ld.conf configuration file for
dynamic loading. If not set,
default to the library directory specified when compiling OCaml.
<DT id="9"><B>OCAMLRUNPARAM</B>
<DD>
Set the runtime system options and garbage collection parameters.
(If OCAMLRUNPARAM is not set, CAMLRUNPARAM will be used instead.)
This variable must be a sequence of parameter specifications separated
by commas.
A parameter specification is a letter, optionally followed by an =
sign, a decimal number (or a hexadecimal number prefixed by
<B>0x</B>),
and an optional multiplier. If the letter is followed by anything
else, the corresponding option is set to 1. Unknown letters
are ignored.
The options are documented below; the
last six correspond to the fields of the
<B>control</B>
record documented in
<I>The OCaml user's manual,</I>
chapter &quot;Standard Library&quot;, section &quot;Gc&quot;.
<DT id="10"><B>b</B>
<DD>
Trigger the printing of a stack backtrace
when an uncaught exception aborts the program.
This option takes no argument.
<DT id="11"><B>p</B>
<DD>
Turn on debugging support for
<B>ocamlyacc</B>-generated
parsers. When this option is on,
the pushdown automaton that executes the parsers prints a
trace of its actions. This option takes no argument.
<DT id="12"><B>R</B>
<DD>
Turn on randomization of all hash tables by default (see the
<B>Hashtbl</B>
module of the standard library). This option takes no
argument.
<DT id="13"><B>h</B>
<DD>
The initial size of the major heap (in words).
<DT id="14"><B>a</B>&nbsp;(allocation_policy)
<DD>
The policy used for allocating in the OCaml heap. Possible values
are 0 for the next-fit policy, and 1 for the first-fit
policy. Next-fit is usually faster, but first-fit is better for
avoiding fragmentation and the associated heap compactions.
<DT id="15"><B>s</B>&nbsp;(minor_heap_size)
<DD>
The size of the minor heap (in words).
<DT id="16"><B>i</B>&nbsp;(major_heap_increment)
<DD>
The default size increment for the major heap (in words).
<DT id="17"><B>o</B>&nbsp;(space_overhead)
<DD>
The major GC speed setting.
<DT id="18"><B>O</B>&nbsp;(max_overhead)
<DD>
The heap compaction trigger setting.
<DT id="19"><B>l</B>&nbsp;(stack_limit)
<DD>
The limit (in words) of the stack size.
<DT id="20"><B>M</B>&nbsp;(custom_major_ratio)
<DD>
Target ratio of floating garbage to
major heap size for out-of-heap memory held by custom values
located in the major heap. The GC speed is adjusted
to try to use this much memory for dead values that are not yet
collected. Expressed as a percentage of major heap size.
The default value keeps the out-of-heap floating garbage about the
same size as the in-heap overhead.
Note: this only applies to values allocated with
<B>caml_alloc_custom_mem</B>
(e.g. bigarrays).
Default: 44.
<DT id="21"><B>m</B>&nbsp;(custom_minor_ratio)
<DD>
Bound on floating garbage for out-of-heap memory
held by custom values in the minor heap. A minor GC is triggered
when this much memory is held by custom values located in the minor
heap. Expressed as a percentage of minor heap size.
Note: this only applies to values allocated with
<B>caml_alloc_custom_mem</B>
(e.g. bigarrays).
<BR>&nbsp;Default:&nbsp;100.
<DT id="22"><B>n</B>&nbsp;(custom_minor_max_size)
<DD>
Maximum amount of out-of-heap
memory for each custom value allocated in the minor heap. When a custom
value is allocated on the minor heap and holds more than this many
bytes, only this value is counted against
<B>custom_minor_ratio</B>
and the rest is directly counted against
<B>custom_major_ratio</B>.
Note: this only applies to values allocated with
<B>caml_alloc_custom_mem</B>
(e.g. bigarrays).
Default: 8192 bytes.
<DT id="23"><B>v</B>&nbsp;(verbose)
<DD>
What GC messages to print to stderr. This is a sum of values selected
from the following:
<P>
<B>0x001</B>
Start of major GC cycle.
<P>
<B>0x002</B>
Minor collection and major GC slice.
<P>
<B>0x004</B>
Growing and shrinking of the heap.
<P>
<B>0x008</B>
Resizing of stacks and memory manager tables.
<P>
<B>0x010</B>
Heap compaction.
<P>
<B>0x020</B>
Change of GC parameters.
<P>
<B>0x040</B>
Computation of major GC slice size.
<P>
<B>0x080</B>
Calling of finalisation functions.
<P>
<B>0x100</B>
Startup messages (loading the bytecode executable file, resolving
shared libraries).
<P>
<B>0x200</B>
Computation of compaction-triggering condition.
<P>
<B>0x400</B>
Output GC statistics at program exit, in the same format as Gc.print_stat.
<P>
The multiplier is
<B>k</B>,
<B>M</B>,&nbsp;or
<B>G</B>,
for multiplication by 2^10, 2^20, and 2^30 respectively.
<P>
If the option letter is not recognized, the whole parameter is ignored;
if the equal sign or the number is missing, the value is taken as 1;
if the multiplier is not recognized, it is ignored.
<P>
For example, on a 32-bit machine under bash, the command
<B>export OCAMLRUNPARAM='s=256k,v=1'</B>
tells a subsequent
<B>ocamlrun</B>
to set its initial minor heap size to 1 megabyte and to print
a message at the start of each major GC cycle.
<DT id="24"><B>CAMLRUNPARAM</B>
<DD>
If OCAMLRUNPARAM is not found in the environment, then CAMLRUNPARAM
will be used instead. If CAMLRUNPARAM is also not found, then the default
values will be used.
<DT id="25"><B>PATH</B>
<DD>
List of directories searched to find the bytecode executable file.
<P>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+ocamlc">ocamlc</A></B>(1).
<BR>
<I>The OCaml user's manual</I>,
chapter &quot;Runtime system&quot;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="26"><A HREF="#lbAB">NAME</A><DD>
<DT id="27"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="28"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="29"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="30"><A HREF="#lbAF">ENVIRONMENT VARIABLES</A><DD>
<DT id="31"><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:20 GMT, March 31, 2021
</BODY>
</HTML>