Direct answer
When a process in a Replit container exceeds its memory allocation, the Linux OOM killer terminates it with SIGKILL (signal 9). The process therefore exits with status 137 (128 + 9). The kernel logs the OOM event to the system log (visible via dmesg or journalctl), and Replit’s console typically shows a line like "Killed" or the exit code 137.
Replit does not expose a Nix‑based knob to tune the OOM‑killer’s behavior; the memory limit is set by the container’s cgroup configuration that Replit applies according to your account tier. You cannot configure a softer threshold inside the project’s Nix files.
Confirmed facts
- The OOM killer sends
SIGKILL, not SIGSEGV or any other signal.
- Exit code 137 is the standard way a shell reports a process killed by signal 9.
- OOM events are recorded in the kernel ring buffer; they appear in
dmesg output or journalctl -k with messages containing "out of memory" and the victim’s PID/command.
- Replit’s UI “Resources” tab reflects the cgroup memory limit; the actual limit can be inspected inside the container at
/sys/fs/cgroup/memory.max (cgroup v2).
Likely explanation
Replit runs each repl in a isolated container that uses cgroups v2 to enforce the RAM quota. When the container’s memory usage hits memory.max, the kernel’s OOM selector chooses a task (usually the memory‑hungry process) and kills it with SIGKILL. Because the kill originates outside the process, the process does not get a chance to handle the event; it simply terminates and reports the signal‑derived exit code.
Steps to verify on your repl
- Run a memory‑intensive test (e.g., a loop that allocates large buffers) and observe the console output.
- After termination, check the exit code with
echo $? – you should see 137.
- Inspect the kernel log:
dmesg | grep -i "out of memory" or journalctl -k | grep -i "out of memory" for a line mentioning your process.
- Confirm the cgroup limit:
cat /sys/fs/cgroup/memory.max – the value should match the RAM quota shown in the Replit Resources tab.
Missing diagnostic detail
If you observe an exit code different from 137, please share that value; it would indicate whether another signal (e.g., SIGSEGV) is involved and could change the recommendation.