THE ORB
Starting the studio

FATAL ERROR: JavaScript heap out of memory

A script used up all available memory and took the server down with it. Something is being kept and never released.

groupsThe whole server crashescodeNeeds a developer

Do this first

Note which resource, and how long the server had been up. This one needs finding properly.

bug_reportPaste your whole console instead

What it means

A Node-based resource used more memory than V8 allows and the runtime aborted. On FXServer this can take the whole server with it, because the JavaScript runtime is in-process.

What causes it

Ordered by how often it is the answer.

  1. 1

    A leak — something accumulating and never cleared

    The classic is a per-player object added on join and never removed on drop. It looks fine for an hour and dies at peak.

  2. 2

    Loading something enormous into memory

    Reading a large file or a whole table into an array at once.

  3. 3

    An unbounded cache

    A Map keyed by something with unlimited variety, never evicted.

  4. 4

    A listener registered per event rather than once

    Handlers accumulating on every trigger.

  5. 5

    Simply too little memory for the workload

    Genuinely needing more than the default heap.

How to tell which one is yours

Watch the process over an hour. Memory that climbs and never comes down between population peaks is a leak; memory that spikes at one specific action is that action.

Where to look

Whatever structure grows: every push, set and [key] = on a module-level object in the resource that died.

How to fix it

Clean up on disconnect, and bound every cache:

on('playerDropped', (reason) => {
    const src = global.source
    delete playerState[src]        // the line people forget
})

Raising the heap buys time, it does not fix a leak:

# server.cfg — a workaround, not a solution
set node_args "--max-old-space-size=4096"

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