Home > Net >  rails console is maxing out Mac memory
rails console is maxing out Mac memory

Time:12-31

I am running Mac OSX 12.1. I have some rails 6 apps and they are working normally in regard to memory usage.

But rails 5.2.6 has a strange memory issue. When I start a rails server or run rspec, the usage of the CPU is normal i.e. low when not much is happening but higher when large tests or heavy server usage occurs.

However, when I use rails console the CPU usage climbs almost immediately to over 100%, and pretty soon the Mac fan starts to run. It stays this way even if I exit the console. I have to do killall ruby to stop all ruby processes. I am monitoring memory using top -o cpu. Is this a known issue with rails 5.2.6? Is there a way to stop this happening?

CodePudding user response:

I suggest to check what initializes when you do rails c. You def should profile your startup times. Start checking your config/initializers folder and also consider Ruby benchmarks

CodePudding user response:

I was experiencing the same problem for quite a while. I've eventually noticed that it's a problem with the listen gem. Updating it is enough to fix it.

Update it to the latest version possible. If I remember correctly, it has to be at least v3.3 for the problem to go away.

  • Related