setgc
Controls the game's collector directly: "stop" (freeze), "restart" (resume), "count" (total KB), "isrunning", "pause" / "setpause" (get/set, 0–1000), "stepmul" / "setstepmul" (get/set, 0–10000).
Syntax
setgc(option: any, value?: any) -> any
Parameters
| Parameter | Type | Description |
|---|---|---|
option | any | The option value used by the call. |
value? | any | The value to apply. |
Returns
| Type | Description |
|---|---|
any | Boolean | number | nil, error |
Description
setgc is part of the GC & memory scanning library. GC helpers read the game's Luau heap from outside the process and can inspect or control the collector.
The change is applied directly to the live target, so later reads observe the updated value.
Example
setgc("stop") -- freeze the game's GC
print(setgc("count"))
setgc("restart") -- resume
Notes
- GC results depend on the live game heap and collector state.