1
2OCAMLRUN(1) General Commands Manual OCAMLRUN(1)
3
4
5
7 ocamlrun - The Objective Caml bytecode interpreter
8
9
11 ocamlrun [ options ] filename argument ...
12
13
15 The ocamlrun(1) command executes bytecode files produced by the linking
16 phase of the ocamlc(1) command.
17
18 The first non-option argument is taken to be the name of the file con‐
19 taining the executable bytecode. (That file is searched in the exe‐
20 cutable path as well as in the current directory.) The remaining argu‐
21 ments are passed to the Objective Caml program, in the string array
22 Sys.argv. Element 0 of this array is the name of the bytecode exe‐
23 cutable file; elements 1 to n are the remaining arguments.
24
25 In most cases, the bytecode executable files produced by the ocamlc(1)
26 command are self-executable, and manage to launch the ocamlrun(1) com‐
27 mand on themselves automatically.
28
29
31 The following command-line options are recognized by ocamlrun(1).
32
33 -b When the program aborts due to an uncaught exception, print a
34 detailed "back trace" of the execution, showing where the excep‐
35 tion was raised and which function calls were outstanding at
36 this point. The back trace is printed only if the bytecode exe‐
37 cutable contains debugging information, i.e. was compiled and
38 linked with the -g option to ocamlc(1) set. This option is
39 equivalent to setting the b flag in the OCAMLRUNPARAM environ‐
40 ment variable (see below).
41
42 -I dir Search the directory dir for dynamically-loaded libraries, in
43 addition to the standard search path. -p Print the names of the
44 primitives known to this version of ocamlrun(1) and exit.
45
46 -v Direct the memory manager to print verbose messages on standard
47 error. This is equivalent to setting v=63 in the OCAMLRUNPARAM
48 environment variable (see below).
49
50 -version
51 Print version and exit.
52
53
55 The following environment variable are also consulted:
56
57 CAML_LD_LIBRARY_PATH
58 Additional directories to search for dynamically-loaded
59 libraries.
60
61 OCAMLLIB
62 The directory containing the Objective Caml standard library.
63 (If OCAMLLIB is not set, CAMLLIB will be used instead.) Used to
64 locate the ld.conf configuration file for dynamic loading. If
65 not set, default to the library directory specified when compil‐
66 ing Objective Caml.
67
68 OCAMLRUNPARAM
69 Set the runtime system options and garbage collection parame‐
70 ters. (If OCAMLRUNPARAM is not set, CAMLRUNPARAM will be used
71 instead.) This variable must be a sequence of parameter speci‐
72 fications. A parameter specification is an option letter fol‐
73 lowed by an = sign, a decimal number (or a hexadecimal number
74 prefixed by 0x), and an optional multiplier. There are nine
75 options, six of which correspond to the fields of the control
76 record documented in The Objective Caml user's manual, chapter
77 "Standard Library", section "Gc".
78
79 b Trigger the printing of a stack backtrace when an uncaught
80 exception aborts the program. This option takes no argument.
81
82 p Turn on debugging support for ocamlyacc-generated parsers. When
83 this option is on, the pushdown automaton that executes the
84 parsers prints a trace of its actions. This option takes no
85 argument.
86
87 a (allocation_policy)
88 The policy used for allocating in the OCaml heap. Possible val‐
89 ues are 0 for the next-fit policy, and 1 for the first-fit pol‐
90 icy. Next-fit is somewhat faster, but first-fit is better for
91 avoiding fragmentation and the associated heap compactions.
92
93 s (minor_heap_size)
94 The size of the minor heap (in words).
95
96 i (major_heap_increment)
97 The default size increment for the major heap (in words).
98
99 o (space_overhead)
100 The major GC speed setting.
101
102 O (max_overhead)
103 The heap compaction trigger setting.
104
105 l (stack_limit)
106 The limit (in words) of the stack size.
107
108 h The initial size of the major heap (in words).
109
110 v (verbose)
111 What GC messages to print to stderr. This is a sum of values
112 selected from the following:
113
114 0x001 Start of major GC cycle.
115
116 0x002 Minor collection and major GC slice.
117
118 0x004 Growing and shrinking of the heap.
119
120 0x008 Resizing of stacks and memory manager tables.
121
122 0x010 Heap compaction.
123
124 0x020 Change of GC parameters.
125
126 0x040 Computation of major GC slice size.
127
128 0x080 Calling of finalisation functions.
129
130 0x100 Startup messages (loading the bytecode executable file,
131 resolving shared libraries).
132
133 The multiplier is k, M or G, for multiplication by 2^10, 2^20,
134 and 2^30 respectively. For example, on a 32-bit machine under
135 bash, the command export OCAMLRUNPARAM='s=256k,v=1' tells a sub‐
136 sequent ocamlrun to set its initial minor heap size to 1
137 megabyte and to print a message at the start of each major GC
138 cycle.
139
140 CAMLRUNPARAM
141 If OCAMLRUNPARAM is not found in the environment, then CAMLRUN‐
142 PARAM will be used instead. If CAMLRUNPARAM is not found, then
143 the default values will be used.
144
145 PATH List of directories searched to find the bytecode executable
146 file.
147
148
150 ocamlc(1).
151 The Objective Caml user's manual, chapter "Runtime system".
152
153
154
155 OCAMLRUN(1)