This is likely a duplicate of https://bugs.ruby-lang.org/issues/2718, although the Backport191 project in redmine appears to be dead. We have found the exact same problem with modern rubies such as 2.3, 2.4, 2.5. The summary is t...jrafanie (Joe Rafaniello)
Please backport r59984, https://bugs.ruby-lang.org/issues/10222. There is a memory leak in ruby 2.3 and 2.4 described here: https://bugs.ruby-lang.org/issues/14372 This backport will require backporting other changes to apply thi...jrafanie (Joe Rafaniello)
Because `Rails.root` is a `Pathname`, it's a fairly common for developers to use Rails.root.join("lib") or something similar in their autoload_paths or eager_load_paths, both of which end up in the $LOAD_PATH and lead to a leak on each c...jrafanie (Joe Rafaniello)
I did a small change to see how the number of Pathnames in the `$LOAD_PATH` changes the leak amount at the script's completion. It looks like the memory leak is linear: 1 74.6 MB 2 149.5 MB 3 214 MB 4 290 MB 5 353.6 MB 9 575.4 ...jrafanie (Joe Rafaniello)
It's worth mentioning that more `Pathname` objects in the `$LOAD_PATH` may make this leak worse as even on ruby 2.5.0, the time for require increases with each added Pathname to the `$LOAD_PATH`.jrafanie (Joe Rafaniello)
There is a memory leak that we have found on ruby 2.3.6 and 2.4.3 that happens on Mac OSX and Linux. Ruby 2.2.6 and 2.5.0 do not leak. We have not tested other platforms. If `$LOAD_PATH` contains one or more Pathname objects, `requi...jrafanie (Joe Rafaniello)
perlun (Per Lundberg) wrote: > This bug unfortunately prevents my organization from using 2.4.1 at the moment, we will have to downgrade to 2.3.4. Is there any chance we could get a bug fix release (2.4.2) out including this fix, in the...jrafanie (Joe Rafaniello)