Excessive Memory Usage

Hey all,

I have a simple node application hosted on the free plan with 256 MB of RAM. However, about every 10 minutes, the application restarts due to running out of free memory. Is anyone else having this problem? When I run the application locally it never uses this much RAM, but, like clockwork, it’s exceeding memory usage on Fly.io.

Any help would be appreciated.

I’m not sure a generic answer is possible without seeing your application, but perhaps adding a swapfile could help. You can do that by adding the following to your CMD/ENTRYPOINT.

fallocate -l 256M /_swapfile && mkswap /_swapfile && chmod 0600 /_swapfile && swapon /_swapfile

An easy way to do that would be to add a small shell script that does the above commands and then whatever you currently have as your CMD, and then modify the CMD to run that script.

Feel free to modify the 256M and name of the swapfile as you see fit.


A few folks have reported this (1, 2).

cc: @wjordan

We do this for our node app on Fly: Is it possible to set vm memory size for less than 256 MB? - #2 by ignoramous

1 Like