Gc
package eval.vm
Available on macro
Memory management control and statistics; finalised values.
Static methods
staticallocated_bytes():Float
Return the total number of bytes allocated since the program was started. It is returned as a float to avoid overflow problems with int on 32-bit machines.
staticcompact():Void
Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.
staticcounters():{promoted_words:Float, minor_words:Float, major_words:Float}
Return (minor_words, promoted_words, major_words). This function is as fast as quick_stat.
staticfinalise<T>(f:T ‑> Void, v:T):Void
Registers f as a finalisation function for v. v must be heap-allocated. f will be called with v as argument at some point between the first time v becomes unreachable (including through weak pointers) and the time v 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 v becomes unreachable). 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 finalise. If finalise 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.
In the presence of multiple OCaml threads it should be assumed that any particular finaliser may be executed in any of the threads.
staticfull_major():Void
Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.
staticget():Control
Return the current values of the GC parameters in a control record.
staticmajor():Void
Do a minor collection and finish the current major collection cycle.
staticmajor_slice():Void
Do a minor collection and a slice of major collection. n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If n = 0, the GC will try to do enough work to ensure that the next automatic slice has no work to do. This function returns an unspecified integer (currently: 0).
staticminor():Void
Trigger a minor collection.
staticprint_stat(out_channel:Output):Void
Print the current values of the memory management counters (in human-readable form) into the channel argument.
staticquick_stat():Stat
Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. This function is much faster than stat because it does not need to go through the heap.
staticset(r:Control):Void
Changes the GC parameters according to the control record r.
staticstat():Stat
Return the current values of the memory management counters in a stat record. This function examines every heap block to get the statistics.
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/eval/vm/Gc.html