한국어English日本語简体中文繁體中文DeutschไทยTiếng ViệtРусскийPortuguês (Brasil)EspañolBahasa Indonesia

Game Lag White Paper › L10 Memory

Script engine GC pause Scripting VM GC (Lua, etc.)

Cause ID mem-script-gc · Primary owner Game team (Server development)

Open the interactive card with figures and simulations →

Even on a C++ server, if quests, AI, and skills run in a scripting language such as Lua, the zone stops while the script engine’s GC runs.

Why Each zone’s script engine creates large numbers of temporary objects while running quests, AI, and events → Effect When the script engine’s GC collects a lot at once, that zone’s tick stops → On screen Periodic hitches only in certain zones or during certain events

Symptoms
Stutter, Freeze
Factors
Stall
Who’s affected
Specific zone/channel
When
When crowds gather, At regular intervals
Owner
Primary owner Game team (Server development)
Game team action items
Configure incremental or generational GC, advance GC a little every tick, reduce temporary objects in scripts.
Ballpark numbers
Once a script heap grows to hundreds of MB, an all-at-once collection (with incremental collection turned off, or a full collection in generational mode) can take tens to hundreds of milliseconds.
On the graph
Periodic spikes · Tick time per zone, script engine memory
Where to look
Record each zone’s tick time and the memory use of that zone’s script engine (collectgarbage("count") in Lua) every tick and overlay them on one graph
Confirmed if
The moments script memory drops sharply (an all-at-once collection) line up with that zone’s tick spikes, while other zones are fine
Ruled out if
Spikes with no change in script memory: that zone’s load or locks. Every zone on the server spikes at once: server GC (mem-gc) or swap (mem-swap)
Check with
Game server or client logs and metrics

Sources

  1. Lua 5.4 Reference Manual Lua.org
    Incremental mode splits collection into small steps interleaved with execution (large steps make it stop-the-world); a major collection in generational mode is a stop-the-world pass over every object; collectgarbage("count") returns the total memory Lua is using (KB)

See also

Same layer: L10 Memory

Same symptom (Stutter), other layers

View the interactive card with figures and simulations