Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GarbageCollector

API to control the garbage collector on the Mono and IL2CPP scripting backends.
Read time 1 minuteLast updated 4 days ago

Definition

public static class GarbageCollector

Remarks

See GarbageCollector.GCMode for how to change the global garbage collector operation mode.

Static Properties

Property

Description

GCModeSet and get global garbage collector operation mode.
incrementalTimeSliceNanosecondsThe target duration of a collection step when performing incremental garbage collection.
isIncrementalReports whether incremental garbage collection is enabled.

Static Methods

Method

Description

CollectIncrementalPerform an on-demand incremental garbage collection for a maximum duration specified by the
nanoseconds
parameter.

Static Events

Member

Description

GCModeChangedSubscribe to this event to get notified when GarbageCollector.GCMode changes.

Enums

Enum

Description

GarbageCollector.ModeGarbage collector operation mode.