<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="Format.html"> <link rel="next" href="Genlex.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Arg" rel="Chapter" href="Arg.html"> <link title="Arith_status" rel="Chapter" href="Arith_status.html"> <link title="Array" rel="Chapter" href="Array.html"> <link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html"> <link title="Big_int" rel="Chapter" href="Big_int.html"> <link title="Bigarray" rel="Chapter" href="Bigarray.html"> <link title="Buffer" rel="Chapter" href="Buffer.html"> <link title="Callback" rel="Chapter" href="Callback.html"> <link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html"> <link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html"> <link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html"> <link title="Char" rel="Chapter" href="Char.html"> <link title="Complex" rel="Chapter" href="Complex.html"> <link title="Condition" rel="Chapter" href="Condition.html"> <link title="Dbm" rel="Chapter" href="Dbm.html"> <link title="Digest" rel="Chapter" href="Digest.html"> <link title="Dynlink" rel="Chapter" href="Dynlink.html"> <link title="Event" rel="Chapter" href="Event.html"> <link title="Filename" rel="Chapter" href="Filename.html"> <link title="Format" rel="Chapter" href="Format.html"> <link title="Gc" rel="Chapter" href="Gc.html"> <link title="Genlex" rel="Chapter" href="Genlex.html"> <link title="Graphics" rel="Chapter" href="Graphics.html"> <link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html"> <link title="Hashtbl" rel="Chapter" href="Hashtbl.html"> <link title="Int32" rel="Chapter" href="Int32.html"> <link title="Int64" rel="Chapter" href="Int64.html"> <link title="Lazy" rel="Chapter" href="Lazy.html"> <link title="Lexing" rel="Chapter" href="Lexing.html"> <link title="List" rel="Chapter" href="List.html"> <link title="ListLabels" rel="Chapter" href="ListLabels.html"> <link title="Map" rel="Chapter" href="Map.html"> <link title="Marshal" rel="Chapter" href="Marshal.html"> <link title="MoreLabels" rel="Chapter" href="MoreLabels.html"> <link title="Mutex" rel="Chapter" href="Mutex.html"> <link title="Nativeint" rel="Chapter" href="Nativeint.html"> <link title="Num" rel="Chapter" href="Num.html"> <link title="Obj" rel="Chapter" href="Obj.html"> <link title="Oo" rel="Chapter" href="Oo.html"> <link title="Parsing" rel="Chapter" href="Parsing.html"> <link title="Pervasives" rel="Chapter" href="Pervasives.html"> <link title="Printexc" rel="Chapter" href="Printexc.html"> <link title="Printf" rel="Chapter" href="Printf.html"> <link title="Queue" rel="Chapter" href="Queue.html"> <link title="Random" rel="Chapter" href="Random.html"> <link title="Scanf" rel="Chapter" href="Scanf.html"> <link title="Set" rel="Chapter" href="Set.html"> <link title="Sort" rel="Chapter" href="Sort.html"> <link title="Stack" rel="Chapter" href="Stack.html"> <link title="StdLabels" rel="Chapter" href="StdLabels.html"> <link title="Str" rel="Chapter" href="Str.html"> <link title="Stream" rel="Chapter" href="Stream.html"> <link title="String" rel="Chapter" href="String.html"> <link title="StringLabels" rel="Chapter" href="StringLabels.html"> <link title="Sys" rel="Chapter" href="Sys.html"> <link title="Thread" rel="Chapter" href="Thread.html"> <link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html"> <link title="Tk" rel="Chapter" href="Tk.html"> <link title="Unix" rel="Chapter" href="Unix.html"> <link title="UnixLabels" rel="Chapter" href="UnixLabels.html"> <link title="Weak" rel="Chapter" href="Weak.html"><title>Gc</title> </head> <body> <div class="navbar"><a href="Format.html">Previous</a> <a href="index.html">Up</a> <a href="Genlex.html">Next</a> </div> <center><h1>Module <a href="type_Gc.html">Gc</a></h1></center> <br> <pre><span class="keyword">module</span> Gc: <code class="code"><span class="keyword">sig</span></code> <a href="Gc.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>Memory management control and statistics; finalised values.<br> <hr width="100%"> <br><code><span id="TYPEstat"><span class="keyword">type</span> <code class="type"></code>stat</span> = {</code><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>minor_words : <code class="type">float</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of words allocated in the minor heap since the program was started. This number is accurate in byte-code programs, but only an approximation in programs compiled to native code.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>promoted_words : <code class="type">float</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of words allocated in the minor heap that survived a minor collection and were moved to the major heap since the program was started.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>major_words : <code class="type">float</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of words allocated in the major heap, including the promoted words, since the program was started.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>minor_collections : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of minor collections since the program was started.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>major_collections : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of major collection cycles completed since the program was started.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>heap_words : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Total size of the major heap, in words.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>heap_chunks : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of contiguous pieces of memory that make up the major heap.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>live_words : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of words of live data in the major heap, including the header words.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>live_blocks : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of live blocks in the major heap.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>free_words : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of words in the free list.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>free_blocks : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of blocks in the free list.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>largest_free : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Size (in words) of the largest block in the free list.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>fragments : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of wasted words due to fragmentation. These are 1-words free blocks placed between two live blocks. They are not available for allocation.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>compactions : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Number of heap compactions since the program was started.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>top_heap_words : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Maximum size reached by the major heap, in words.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>stack_size : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Current size of the stack, in words.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr></table> } <div class="info"> The memory management counters are returned in a <code class="code">stat</code> record. <p> The total amount of memory allocated by the program since it was started is (in words) <code class="code">minor_words + major_words - promoted_words</code>. Multiply by the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the number of bytes.<br> </div> <br><code><span id="TYPEcontrol"><span class="keyword">type</span> <code class="type"></code>control</span> = {</code><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>minor_heap_size : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. Default: 32k.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>major_heap_increment : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The minimum number of words to add to the major heap when increasing it. Default: 124k.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>space_overhead : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediatly collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if <code class="code">space_overhead</code> is smaller. Default: 80.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>verbose : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:<ul> <li><code class="code">0x001</code> Start of major GC cycle.</li> <li><code class="code">0x002</code> Minor collection and major GC slice.</li> <li><code class="code">0x004</code> Growing and shrinking of the heap.</li> <li><code class="code">0x008</code> Resizing of stacks and memory manager tables.</li> <li><code class="code">0x010</code> Heap compaction.</li> <li><code class="code">0x020</code> Change of GC parameters.</li> <li><code class="code">0x040</code> Computation of major GC slice size.</li> <li><code class="code">0x080</code> Calling of finalisation functions.</li> <li><code class="code">0x100</code> Bytecode executable search at start-up.</li> <li><code class="code">0x200</code> Computation of compaction triggering condition. Default: 0.</li> </ul> </td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>max_overhead : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Heap compaction is triggered when the estimated amount of "wasted" memory is more than <code class="code">max_overhead</code> percent of the amount of live data. If <code class="code">max_overhead</code> is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If <code class="code">max_overhead >= 1000000</code>, compaction is never triggered. Default: 500.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>stack_limit : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The maximum size of the stack (in words). This is only relevant to the byte-code runtime, as the native code runtime uses the operating system's stack. Default: 256k.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>allocation_policy : <code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The policy used for allocating in the heap. Possible values are 0 and 1. 0 is the next-fit policy, which is quite fast but can result in fragmentation. 1 is the first-fit policy, which can be slower in some cases but can be better for programs with fragmentation problems. Default: 0.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr></table> } <div class="info"> The GC parameters are given as a <code class="code">control</code> record. Note that these parameters can also be initialised by setting the OCAMLRUNPARAM environment variable. See the documentation of ocamlrun.<br> </div> <pre><span id="VALstat"><span class="keyword">val</span> stat</span> : <code class="type">unit -> <a href="Gc.html#TYPEstat">stat</a></code></pre><div class="info"> Return the current values of the memory management counters in a <code class="code">stat</code> record. This function examines every heap block to get the statistics.<br> </div> <pre><span id="VALquick_stat"><span class="keyword">val</span> quick_stat</span> : <code class="type">unit -> <a href="Gc.html#TYPEstat">stat</a></code></pre><div class="info"> Same as <code class="code">stat</code> except that <code class="code">live_words</code>, <code class="code">live_blocks</code>, <code class="code">free_words</code>, <code class="code">free_blocks</code>, <code class="code">largest_free</code>, and <code class="code">fragments</code> are set to 0. This function is much faster than <code class="code">stat</code> because it does not need to go through the heap.<br> </div> <pre><span id="VALcounters"><span class="keyword">val</span> counters</span> : <code class="type">unit -> float * float * float</code></pre><div class="info"> Return <code class="code">(minor_words, promoted_words, major_words)</code>. This function is as fast at <code class="code">quick_stat</code>.<br> </div> <pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type">unit -> <a href="Gc.html#TYPEcontrol">control</a></code></pre><div class="info"> Return the current values of the GC parameters in a <code class="code">control</code> record.<br> </div> <pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type"><a href="Gc.html#TYPEcontrol">control</a> -> unit</code></pre><div class="info"> <code class="code">set r</code> changes the GC parameters according to the <code class="code">control</code> record <code class="code">r</code>. The normal usage is: <code class="code"><span class="constructor">Gc</span>.set { (<span class="constructor">Gc</span>.get()) <span class="keyword">with</span> <span class="constructor">Gc</span>.verbose = 0x00d }</code><br> </div> <pre><span id="VALminor"><span class="keyword">val</span> minor</span> : <code class="type">unit -> unit</code></pre><div class="info"> Trigger a minor collection.<br> </div> <pre><span id="VALmajor_slice"><span class="keyword">val</span> major_slice</span> : <code class="type">int -> int</code></pre><div class="info"> Do a minor collection and a slice of major collection. The argument is the size of the slice, 0 to use the automatically-computed slice size. In all cases, the result is the computed slice size.<br> </div> <pre><span id="VALmajor"><span class="keyword">val</span> major</span> : <code class="type">unit -> unit</code></pre><div class="info"> Do a minor collection and finish the current major collection cycle.<br> </div> <pre><span id="VALfull_major"><span class="keyword">val</span> full_major</span> : <code class="type">unit -> unit</code></pre><div class="info"> Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.<br> </div> <pre><span id="VALcompact"><span class="keyword">val</span> compact</span> : <code class="type">unit -> unit</code></pre><div class="info"> Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.<br> </div> <pre><span id="VALprint_stat"><span class="keyword">val</span> print_stat</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info"> Print the current values of the memory management counters (in human-readable form) into the channel argument.<br> </div> <pre><span id="VALallocated_bytes"><span class="keyword">val</span> allocated_bytes</span> : <code class="type">unit -> float</code></pre><div class="info"> Return the total number of bytes allocated since the program was started. It is returned as a <code class="code">float</code> to avoid overflow problems with <code class="code">int</code> on 32-bit machines.<br> </div> <pre><span id="VALfinalise"><span class="keyword">val</span> finalise</span> : <code class="type">('a -> unit) -> 'a -> unit</code></pre><div class="info"> <code class="code">finalise f v</code> registers <code class="code">f</code> as a finalisation function for <code class="code">v</code>. <code class="code">v</code> must be heap-allocated. <code class="code">f</code> will be called with <code class="code">v</code> as argument at some point between the first time <code class="code">v</code> becomes unreachable and the time <code class="code">v</code> is collected by the GC. Several functions can be registered for the same value, or even several instances of the same function. Each instance will be called once (or never, if the program terminates before <code class="code">v</code> becomes unreachable). <p> The GC will call the finalisation functions in the order of deallocation. When several values become unreachable at the same time (i.e. during the same GC cycle), the finalisation functions will be called in the reverse order of the corresponding calls to <code class="code">finalise</code>. If <code class="code">finalise</code> is called in the same order as the values are allocated, that means each value is finalised before the values it depends upon. Of course, this becomes false if additional dependencies are introduced by assignments. <p> Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:<ul> <li><code class="code"> <span class="keyword">let</span> v = ... <span class="keyword">in</span> <span class="constructor">Gc</span>.finalise (<span class="keyword">fun</span> x <span class="keywordsign">-></span> ...) v </code></li> </ul> Instead you should write:<ul> <li><code class="code"> <span class="keyword">let</span> f = <span class="keyword">fun</span> x <span class="keywordsign">-></span> ... ;; <span class="keyword">let</span> v = ... <span class="keyword">in</span> <span class="constructor">Gc</span>.finalise f v </code></li> </ul> The <code class="code">f</code> function can use all features of O'Caml, including assignments that make the value reachable again. It can also loop forever (in this case, the other finalisation functions will not be called during the execution of f, unless it calls <code class="code">finalise_release</code>). It can call <code class="code">finalise</code> on <code class="code">v</code> or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when the function was called. <p> <code class="code">finalise</code> will raise <code class="code"><span class="constructor">Invalid_argument</span></code> if <code class="code">v</code> is not heap-allocated. Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. You should also be aware that compiler optimisations may duplicate some immutable values, for example floating-point numbers when stored into arrays, so they can be finalised and collected while another copy is still in use by the program. <p> The results of calling <a href="String.html#VALmake"><code class="code"><span class="constructor">String</span>.make</code></a>, <a href="String.html#VALcreate"><code class="code"><span class="constructor">String</span>.create</code></a>, <a href="Array.html#VALmake"><code class="code"><span class="constructor">Array</span>.make</code></a>, and <a href="Pervasives.html#VALref"><code class="code">ref</code></a> are guaranteed to be heap-allocated and non-constant except when the length argument is <code class="code">0</code>.<br> </div> <pre><span id="VALfinalise_release"><span class="keyword">val</span> finalise_release</span> : <code class="type">unit -> unit</code></pre><div class="info"> A finalisation function may call <code class="code">finalise_release</code> to tell the GC that it can launch the next finalisation function without waiting for the current one to return.<br> </div> <pre><span id="TYPEalarm"><span class="keyword">type</span> <code class="type"></code>alarm</span> </pre> <div class="info"> An alarm is a piece of data that calls a user function at the end of each major GC cycle. The following functions are provided to create and delete alarms.<br> </div> <pre><span id="VALcreate_alarm"><span class="keyword">val</span> create_alarm</span> : <code class="type">(unit -> unit) -> <a href="Gc.html#TYPEalarm">alarm</a></code></pre><div class="info"> <code class="code">create_alarm f</code> will arrange for <code class="code">f</code> to be called at the end of each major GC cycle, starting with the current cycle or the next one. A value of type <code class="code">alarm</code> is returned that you can use to call <code class="code">delete_alarm</code>.<br> </div> <pre><span id="VALdelete_alarm"><span class="keyword">val</span> delete_alarm</span> : <code class="type"><a href="Gc.html#TYPEalarm">alarm</a> -> unit</code></pre><div class="info"> <code class="code">delete_alarm a</code> will stop the calls to the function associated to <code class="code">a</code>. Calling <code class="code">delete_alarm a</code> again has no effect.<br> </div> </body></html>