Something that always bothered me was rubocop asking to add
# frozen_string_literal: true to my ruby files. I always ended up removing the
option on rubocop configuration.
It turns out that this comment can save a lot of memory on your running projects. This option avoids the same string being allocated many times in the memory.
To add the magic comment to the beginning of all ruby files, simply run this command:
The second command is to add a blank line after the magic comment. I’m not sure
how to run two rubocop
--only at once, so I prefer to run the two commands.
The result of this was that I was receiving notifications about the high memory usage, and after that, the project never had a memory issue again.