Is there a way to remove ActionMailbox from my Rails app? I’m getting out of memory errors with Rails 6, and derailer shows action_mailbox as the lead memory hog — even though my app doesn’t use it:
I think this is an issue. I love how Rails gives you everything out-of-the-box, but the price to pay to have actionmailbox already included is too high. 30MB loaded in memory is not an irrelevant amount.
This knowledge may be out-of-date, but at one point in time, the reason why ActionMailbox uses so much memory is:
ActionMailbox relies upon the Mail gem to parse emails. The Mail gem parses emails by creating several state machines with Ragel, which works by creating big arrays of integers which is the source of the memory usage.
Update: So far, I’ve found no way to prevent it from being loaded. If anyone has a verified solution — not just a theoretical one — I’d love to hear it.
In the meantime, I’ve gotten my app’s RAM use to easily fit on a 1MB instance by limiting calls to asset helpers.
I ran into this issue, found this thread, and I want to confirm that the listed solutions worked fine.
If you are using derailed_benchmarks - make sure you are not using the static analysis of the Gemfile, because that won’t correctly reflect the fact that the libraries are no longer loaded in your app.