Open netwire88 opened 2 years ago
the gem's showing up in production
Because it's added to derailed in development. So when you're running in production for real (not just simulating it with derailed) you also won't have dead_end.
it seems to be creating huge memory footprint upon launching of app
I've described the issue here https://github.com/zombocom/dead_end/issues/124#issuecomment-1006705016. The TLDR is that any gem that patches into require
(such as dead_end or bootsnap etc) will show up here as derailed ALSO patches into require and that's how it gets it's info.
If it's causing confusion we could perhaps introduce an env var into dead_end that would optionally disable the monekypatching behavior. We could also move it from a general derailed require to a per-task require.
Also that output is from memory_profiler. One question to ask is: why isn't this a problem for bootsnap? Did get it special cased somehow?
Just ran into this myself, and was admittedly confused when the single largest consumer of "allocated memory by gem" by a long way was (indirectly) from the package I just installed to examine the memory itself (derailed_benchmark).
$ bundle exec derailed bundle:objects
Measuring objects created by gems in groups [:default, "production"]
Total allocated: 94891342 bytes (956756 objects)
Total retained: 19576854 bytes (177325 objects)
allocated memory by gem
-----------------------------------
60670886 dead_end-3.1.1
6590809 mime-types-3.3.1
4019827 json-2.5.1
3301861 set
# **SNIP**
Thankfully this GitHub issue came up relatively quick from searching, but it's not a particularly great first-time experience to immediately get led on a (short) wild goose chase inflicted by this very gem. If there is a way to suppress derailed's own dependencies from the output (when they are not otherwise used by the host application of course), I think I'm in favor of that.
I have the following in my Gemfile
However, when I run
bundle exec derailed bundle:objects production
, I see the followingand when I run
bundle exec gem dep -R
I see that dead_end is only used by derailed_benchmarksI'm a bit confused why:
production
Any thoughts?
I'm not sure if it's related to this issue action_mailbox/engine still loads even after not requiring it in application.rb where @andrehjr says it's derailed_benchmark's use of
require "action_controller/railtie"