Domingo Edwards
Domingo Edwards
I researched a little bit, and belive that the path is a good interface. Ruby has [`$LOAD_PATH`](https://docs.ruby-lang.org/en/3.4/globals_rdoc.html#label-24LOAD_PATH+-28Load+Path-29), zeitwerk has the [dirs method to return autoload dirs](https://www.rubydoc.info/gems/zeitwerk/Zeitwerk/Loader/Config#dirs-instance_method), and rails work on...
The other solution that i belive it could be experimented is using [WeakRef](https://docs.ruby-lang.org/en/3.4/WeakRef.html), so when the constants disapear from scope, the GC will also collect those weakrefs. The WeakRef solution,...
This solution seems to remove the leak. ```ruby # autoloaders.main is an instance of Zeitwerk::Loader autoloaders.main.on_unload do |cpath, value, abspath| # Remove the class itself T::Private::Methods.instance_variable_get(:@installed_hooks).delete(value) T::Private::Methods.instance_variable_get(:@sig_wrappers).delete_if do |key, _|...
Off topic, @bdewater-thatch the bug has it's [own issue in delayed job](https://github.com/collectiveidea/delayed_job/issues/776), and a solution like that could be discussed there. Thanks for the suggestion.
A little update, we ended up with the following more clean and concise solution with our team ```ruby Rails.application.config.after_initialize do unload_sigs = ->(mod) do obj_id = mod.object_id.to_s T::Private::Methods.instance_variable_get(:@installed_hooks).delete(mod) method_ids =...
It seems good to me, we are still iterating a little bit the snippet above in our monolith. Including 1. Instance methods 2. Private methods 3. class methods 4. Private...
@froydnj just opened a patch for this, as I said before, i need to make some manual tests of this patch in our monolith and in a dummy leaky rails...
Wait until we test the patch in our monolith, tracing the retained memory works as a good QA for the patch.
> Wait until we test the patch in our monolith, tracing the retained memory works as a good QA for the patch. @froydnj just tested the patch in our monolith...