Memory Limit Hit following rubyrailstutorial.org
Hi,
I am following the tutorial on Ruby Rails Tutorial and I am using the Cloud9 IDE however I keep getting a "Memory Limit Hit" when running through the tutorial. I am using the free tier which comes with 512MB Ram which is constantly in the red zone.
I have tried killing some processes, but as soon as I start back on the tutorial I keep getting the error.
Thanks
Michael
Originally Answered: How does a computer work if it hits the ram limit? When you run out of physical RAM, your computer will start to use “virtual RAM”. This means it will start using up some temporary space in your primary storage drive (HDD/SSD) since it doesn't have enough RAM.
If the memory usage is close to 100%, this can slow things down a lot. This is because the computer will then try to use your hard disk as a temporary memory store, called swap memory. Hard disks are much slower than the system memory. You can try to free up some system memory by closing some programs.
The memory limit setting fixes a memory size for executing a script. It prevents ineffectively coded scripts on the server that designate superfluous space, thus sparing server memory during large-scale utilization of the application.
Short answer: Spring has a bug that causes it to use up memory by spawning too many processes.
From your c9 shell, run
pkill -9 -f spring
and restart your rails server.
Longer answer: He describes a lot about it in Chapter 3 of the tutorial. Box 3.4 on this page https://www.railstutorial.org/book/static_pages covers it nicely.
Incidentally, I found that I couldn't simply restart my c9 session...it's really good at persisting the state of your virtual server ... including all of the extra Spring processes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With