# Garbage Collector Interface

# Public Interface

The public interface of the Mono GC is fairly limited, and its the only one that embedders should be using:
mono_gc_collect
void mono_gc_collect (int generation)

Parameters

> generation:
>   GC generation identifier

Remarks

Perform a garbage collection for the given generation, higher numbers mean usually older objects. Collecting a high-numbered generation implies collecting also the lower-numbered generations. The maximum value for generation can be retrieved with a call to mono_gc_max_generation(), so this function is usually called as: mono_gc_collect (mono_gc_max_generation ());
mono_gc_max_generation
int mono_gc_max_generation (void)

Returns

> the maximum generation number.

Remarks

Get the maximum generation number used by the current garbage collector. The value will be 0 for the Boehm collector, 1 or more for the generational collectors.
mono_gc_get_heap_size
int64_t mono_gc_get_heap_size (void)

Returns

> the size of the heap in bytes

Remarks

Get the amount of memory used by the garbage collector.