Lua memory + GC object census (by type)
get-memory-statsReport Lua VM heap usage and count GC objects by type to spot leaks, gauge Roblox client memory, or take before/after baselines.
Instructions
In-game memory health probe. Reports the Lua VM's current heap usage via gcinfo() (in KB, guarded) and takes a census of the garbage collector by walking getgc(true) and counting objects by type — function, table, thread, userdata, and other. Optionally adds engine-level memory from game:GetService('Stats') (GetTotalMemoryUsageMb and a few notable categories) when available. Use this to gauge how heavy the client is, to spot a runaway table/closure leak (an unusually large gcObjectCount or byType.table), or to take a baseline before/after running an exploit. The GC walk is capped (maxScan, default 200000) and sets truncated=true if it hits the cap. Requires getgc for the census (reports gcObjectCount=nil if absent); gcinfo and Stats are optional. Returns { luaMemoryKB, gcObjectCount, truncated, byType, engineMemory } or { error }. Signature: { maxScan: any?, threadContext: number? }. Phase: observe; cost=high; idempotency=read-only. Requires: active-client. Produces: structured-observation, diagnostic-report. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxScan | No | Maximum number of GC objects to visit during the census (default 200000). The walk stops at this cap and sets truncated=true; raise it on a very large game if you need an exact count, lower it to bound cost. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |