Out of memory on Render: what “Ran out of memory” means, and how to see it coming
On Render, out of memory shows in the events as Ran out of memory (used over 512MB) while running your code: your instance went over its instance type’s memory and was killed, often with exit status 137. Render restarts the instance. If it happens during startup, the deploy fails. If it keeps happening, the service turns unhealthy. For the general picture, see exit code 137 and OOM killed.
Why the Metrics tab disagrees
Render’s Metrics tab estimates memory at points in time, so a short spike can miss the graph. A common report on Render’s community forum is an out-of-memory event next to a graph that never came near the limit. Treat the event as the truth, and look for the work that ran just before it.
How to fix it
- Move up an instance type. The memory in the event message is your instance type’s limit.
- Cut workers. Lower
WEB_CONCURRENCYor the Gunicorn worker count. Each worker holds its own copy of the app. - Cap the runtime. For Node, set
--max-old-space-sizeto about 75 percent of the instance’s memory. - Run production builds. A development server, or a build step in the start command, can use far more memory than the app itself.
- Move heavy jobs to a background worker, so a spike there does not restart the web service.
What Render warns you about
Render emails or posts to Slack when a deploy fails, a service turns unhealthy or a disk passes 80 percent. It has no memory threshold alert, so the first message you get is about the failure itself.