OOM Error

I keep on getting an OOM error!
Even when I scale up the memory, the app starts working for a while and then I receive the same error again.
Out of memory: Killed process 547 (node) total-vm:11259808kB, anon-rss:131356kB, file-rss:0kB, shmem-rss:0kB, UID:65534 pgtables:3312kB oom_score_adj:0
The thing is I haven’t changed anything in my code and it used to work before without errors.

Hello,

If the app works for a while then says out of memory. it sounds like a memory leak. I assume you have some kind of process manager or using Fly to restart the process.

If node means Nodejs, you can edit the value using an environment variable (in your fly.toml) to what your app needs e.g for 1GB

NODE_OPTIONS="--max-old-space-size=1024"

However if it is a memory leak, gradually using more over time, the better fix is to find out what is causing it. Like from a global variable, memory being allocated but not released etc. That’s a tricky one. I’d look into monitoring tools. Most will have some kind of free trial.

1 Like

Might come in handy: GitHub - airbnb/node-memwatch: A NodeJS library to keep an eye on your memory usage, and discover and isolate leaks.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.