[ruby-core:126156] [Ruby Bug#22210] Check if issue #19969 is still reproducible / re-opened in 4.0.x
Issue #22210 has been reported by saka_omo (Yuki Takei). ---------------------------------------- Bug #22210: Check if issue #19969 is still reproducible / re-opened in 4.0.x https://bugs.ruby-lang.org/issues/22210 * Author: saka_omo (Yuki Takei) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Hi team, I am writing to ask if Bug #19969 might still be reproducible in the current version of Ruby. Could you please check if the issue is still present or if a regression has occurred? I ran the reproduction script from #19969 across several Ruby versions on macOS (arm64-darwin), and while Ruby 3.2.4 fixed the high memory consumption (dropping to 29 MiB), Ruby 4.0.5 spikes back up to 2215 MiB. ``` ruby ruby -v -rset -e 's1 = Set.new(10000.times); s2 = Set.new(9999.times); Array.new(10000) { s1 - s2 - [0] }; puts "#{`ps -o rss= -p #{$$}`.to_i / 1024} MiB"' ``` Results across versions: ``` ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin22] 183 MiB ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] 2364 MiB ruby 3.2.4 (2024-04-23 revision af471c0e01) [arm64-darwin22] 29 MiB ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24] 2215 MiB ``` -- https://bugs.ruby-lang.org/
Issue #22210 has been updated by jeremyevans0 (Jeremy Evans). Backport changed from 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED Thank you for the report. I looked into this and the related functions for `st_table` are implemented for `set_table` (`set_rebuild_table_with`, `set_rebuild_move_table`, `set_rebuild_cleanup`, `rb_set_compact_table`). For the `Set` class, `set_compact_after_delete` is implemented, and the following functions call it: * `delete` * `delete?` * `delete_if` * `reject!` * `clear` Methods that remove elements from a set but did not call `set_compact_after_delete`: * `^` * `-` * `difference` * `subtract` * `keep_if` * `select!` * `filter!` I've submitted a pull request to fix these issues: https://github.com/ruby/ruby/pull/18058 ---------------------------------------- Bug #22210: Check if issue #19969 is still reproducible / re-opened in 4.0.x https://bugs.ruby-lang.org/issues/22210#change-118216 * Author: saka_omo (Yuki Takei) * Status: Open * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED ---------------------------------------- Hi team, I am writing to ask if Bug #19969 might still be reproducible in the current version of Ruby. Could you please check if the issue is still present or if a regression has occurred? I ran the reproduction script from #19969 across several Ruby versions on macOS (arm64-darwin), and while Ruby 3.2.4 fixed the high memory consumption (dropping to 29 MiB), Ruby 4.0.5 spikes back up to 2215 MiB. ``` ruby ruby -v -rset -e 's1 = Set.new(10000.times); s2 = Set.new(9999.times); Array.new(10000) { s1 - s2 - [0] }; puts "#{`ps -o rss= -p #{$$}`.to_i / 1024} MiB"' ``` Results across versions: ``` ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin22] 183 MiB ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] 2364 MiB ruby 3.2.4 (2024-04-23 revision af471c0e01) [arm64-darwin22] 29 MiB ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24] 2215 MiB ``` -- https://bugs.ruby-lang.org/
Issue #22210 has been updated by saka_omo (Yuki Takei). Thank you so much for the quick fix! Really appreciate your fast help. I really hope this will help reduce memory usage in Rails. ---------------------------------------- Bug #22210: Check if issue #19969 is still reproducible / re-opened in 4.0.x https://bugs.ruby-lang.org/issues/22210#change-118244 * Author: saka_omo (Yuki Takei) * Status: Open * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED ---------------------------------------- Hi team, I am writing to ask if Bug #19969 might still be reproducible in the current version of Ruby. Could you please check if the issue is still present or if a regression has occurred? I ran the reproduction script from #19969 across several Ruby versions on macOS (arm64-darwin), and while Ruby 3.2.4 fixed the high memory consumption (dropping to 29 MiB), Ruby 4.0.5 spikes back up to 2215 MiB. ``` ruby ruby -v -rset -e 's1 = Set.new(10000.times); s2 = Set.new(9999.times); Array.new(10000) { s1 - s2 - [0] }; puts "#{`ps -o rss= -p #{$$}`.to_i / 1024} MiB"' ``` Results across versions: ``` ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin22] 183 MiB ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] 2364 MiB ruby 3.2.4 (2024-04-23 revision af471c0e01) [arm64-darwin22] 29 MiB ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24] 2215 MiB ``` -- https://bugs.ruby-lang.org/
Issue #22210 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed Fixed by commit:388ea3c3cf19380bf47916a4e6babc16886cd8bc Backport commit for 4.0: https://github.com/ruby/ruby/pull/18081 ---------------------------------------- Bug #22210: Check if issue #19969 is still reproducible / re-opened in 4.0.x https://bugs.ruby-lang.org/issues/22210#change-118253 * Author: saka_omo (Yuki Takei) * Status: Closed * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED ---------------------------------------- Hi team, I am writing to ask if Bug #19969 might still be reproducible in the current version of Ruby. Could you please check if the issue is still present or if a regression has occurred? I ran the reproduction script from #19969 across several Ruby versions on macOS (arm64-darwin), and while Ruby 3.2.4 fixed the high memory consumption (dropping to 29 MiB), Ruby 4.0.5 spikes back up to 2215 MiB. ``` ruby ruby -v -rset -e 's1 = Set.new(10000.times); s2 = Set.new(9999.times); Array.new(10000) { s1 - s2 - [0] }; puts "#{`ps -o rss= -p #{$$}`.to_i / 1024} MiB"' ``` Results across versions: ``` ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin22] 183 MiB ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] 2364 MiB ruby 3.2.4 (2024-04-23 revision af471c0e01) [arm64-darwin22] 29 MiB ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24] 2215 MiB ``` -- https://bugs.ruby-lang.org/
Issue #22210 has been updated by alanwu (Alan Wu). Backport changed from 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE jeremyevans0 (Jeremy Evans) wrote in #note-3:
Fixed by commit:388ea3c3cf19380bf47916a4e6babc16886cd8bc
Backport commit for 4.0: https://github.com/ruby/ruby/pull/18081
Backport for 4.0 merged. ---------------------------------------- Bug #22210: Check if issue #19969 is still reproducible / re-opened in 4.0.x https://bugs.ruby-lang.org/issues/22210#change-118588 * Author: saka_omo (Yuki Takei) * Status: Closed * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ---------------------------------------- Hi team, I am writing to ask if Bug #19969 might still be reproducible in the current version of Ruby. Could you please check if the issue is still present or if a regression has occurred? I ran the reproduction script from #19969 across several Ruby versions on macOS (arm64-darwin), and while Ruby 3.2.4 fixed the high memory consumption (dropping to 29 MiB), Ruby 4.0.5 spikes back up to 2215 MiB. ``` ruby ruby -v -rset -e 's1 = Set.new(10000.times); s2 = Set.new(9999.times); Array.new(10000) { s1 - s2 - [0] }; puts "#{`ps -o rss= -p #{$$}`.to_i / 1024} MiB"' ``` Results across versions: ``` ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin22] 183 MiB ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] 2364 MiB ruby 3.2.4 (2024-04-23 revision af471c0e01) [arm64-darwin22] 29 MiB ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24] 2215 MiB ``` -- https://bugs.ruby-lang.org/
participants (3)
-
alanwu (Alan Wu) -
jeremyevans0 (Jeremy Evans) -
saka_omo (Yuki Takei)