
Issue #21173 has been updated by tenderlovemaking (Aaron Patterson). Backport changed from 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE Backported in 762e76cc50db059e71d1f6c13674103a488f5171 ---------------------------------------- Bug #21173: RUBY_FREE_AT_EXIT does not work when error in -r https://bugs.ruby-lang.org/issues/21173#change-112387 * Author: peterzhu2118 (Peter Zhu) * Status: Closed * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ---------------------------------------- PR: https://github.com/ruby/ruby/pull/12859 When loading a file using the command line -r, it is processed before RUBY_FREE_AT_EXIT is checked. So if the loaded file raises an error, it will cause memory to not be freed with RUBY_FREE_AT_EXIT. For example `ruby -rtest.rb -e ""` will report a large amount of memory leaks if `test.rb` raises. -- https://bugs.ruby-lang.org/