8

I want a new Rails 6 app without Action Mailbox or Action Text, so I create one with

rails new myapp --skip-action-mailbox --skip-action-text

I then remove them in application.rb

But when I run bundle exec derailed bundle:mem it shows that they are still there:

rails/all: 36.2539 MiB
    action_mailbox/engine: 13.5313 MiB

How can I remove them to save on memory?

Jun Dalisay
  • 1,165
  • 2
  • 12
  • 26
  • 2
    See if this answer helps: https://stackoverflow.com/a/60515382/2545197 – Abhinay Oct 15 '20 at 05:26
  • Does this answer your question? [Omit action mailbox, activestorage, and conductor routes from bin/rails routes in Rails 6?](https://stackoverflow.com/questions/59593542/omit-action-mailbox-activestorage-and-conductor-routes-from-bin-rails-routes-i) – Eyeslandic Oct 15 '20 at 06:52
  • Did you put `derailed` into the `development` group? – schmijos Mar 13 '23 at 13:28

2 Answers2

1

I have the same problem, even with my application.rb looking like this:

%w(
  action_controller/railtie
  action_view/railtie
  active_job/railtie
  sprockets/railtie
).each do |railtie|
  begin
    require railtie
  rescue LoadError
  end
end

bundle exec derailed bundle:mem still shows this:

TOP: 121.7656 MiB
  rails/all: 71.375 MiB
    action_mailbox/engine: 41.5 MiB
      action_mailbox: 41.4688 MiB
        action_mailbox/mail_ext: 41.4688 MiB
          action_mailbox/mail_ext/address_equality.rb: 39.6875 MiB
            mail/elements/address: 39.6875 MiB
              mail/parsers/address_lists_parser: 39.6094 MiB (Also required by: mail/parsers)
                mail/parsers: 7.5313 MiB
                  mail/parsers/received_parser: 5.1563 MiB
                  mail/parsers/envelope_from_parser: 1.4844 MiB
                  mail/parsers/message_ids_parser: 0.3281 MiB
          mail: 1.7344 MiB
            mail/field: 0.7813 MiB
netwire
  • 7,108
  • 12
  • 52
  • 86
0

Ran into the same issue, which actually is somewhat of a red herring. It's the derailed_benchmark gem itself that loads all of rails. See this issue:

https://github.com/rails/rails/issues/41361

I think that's because rails/all is required when running derailed bundle:mem here.

The (as yet unreleased) main branch of the gem provides the environment variable DERAILED_SKIP_RAILS_REQUIRES, but that just caused exceptions when run on my particular rails app with derailed bundle:mem.

So the solution is to either ignore this and take into account that action_mailbox is not in fact loaded by your app, or use dynamic benchmarking as described in the README:

bundle exec derailed perf:mem
Thilo
  • 17,565
  • 5
  • 68
  • 84