THE ORB
Starting the studio

Ran out of script memory

Something ran out of memory. It is not about how busy the server is; something is piling up and never being cleared.

groupsCrashes after hours of uptimecodeNeeds a developer

Do this first

Note how long the server had been running. If restarting fixes it for a while, it is a leak.

bug_reportPaste your whole console instead

What it means

A script runtime asked for memory it could not get. On the client this crashes the game; on the server it usually takes the resource, sometimes the process.

Unlike a hitch this is not a symptom of load — it is a symptom of accumulation. Something is being kept that should have been released.

What causes it

Ordered by how often it is the answer.

  1. 1

    A table that only ever grows

    Per-player state added on join and never removed on drop. It survives testing and dies at peak.

  2. 2

    Entities created and never deleted

    Each one costs memory as well as a pool slot.

  3. 3

    A cache with no eviction

    Keyed by something unbounded — coordinates, timestamps, net ids.

  4. 4

    Very large strings held in memory

    JSON of a whole table kept in a variable rather than being consumed and dropped.

  5. 5

    Closures capturing more than they need

    Every closure holds its upvalues alive, so one stored callback can keep a large table from ever being collected.

How to tell which one is yours

Watch it over time rather than at a moment:

-- server, once a minute
print(('lua kb: %.0f'):format(collectgarbage('count')))

A number that only rises across population peaks is a leak. One that rises and falls is normal.

Where to look

Every table at file scope in the resource that died, and whether anything ever removes from it.

How to fix it

Remove on the way out, always:

AddEventHandler('playerDropped', function()
    local src = source
    playerState[src] = nil        -- the line people forget
    cache[src] = nil
end)

Still stuck on your own code?

This page is what this error usually means. Paste your console into Server Fixer and it will rank everything in it and tell you what to do first, and if you would rather not touch it, ORBIE can repair the script and hand the resource back ready to drop in.

bug_reportOpen Server Fixer

Errors that travel with this one