Diagnostic code · ARA0300
Allocation on the tick path
A [Query] system, behaviour OnTick/OnFrame, or command Execute allocates on its tick path, including inside nested lambdas and local functions. This is a warning: compilation can succeed, but repeated allocations can cause GC pauses.
Common causes
- Creating classes or arrays, calling LINQ, boxing values, or declaring non-static lambdas.
- Building strings with interpolation or concatenation on the tick path.
Fixes
Use value types, spans, bounded
stackalloc, or reusable pooled buffers instead of per-tick heap objects.Replace allocating LINQ with loops, avoid boxing, and use static lambdas where possible.
Move string formatting and other avoidable allocations out of recurring tick work.
Code:
ARA0300Constant:
cs::TICK_ALLOCATIONReported by: Ara.Analyzers