From: "wanabe (_ wanabe) via ruby-core" Date: 2026-08-24T10:31:58+00:00 Subject: [ruby-core:126479] [Ruby Bug#19970] Eval leaks callcache and callinfo objects on arm32 (linux) Issue #19970 has been updated by wanabe (_ wanabe). Status changed from Open to Closed It has been fixed at 1c97abaabae6844c861705fd07f532292dcffa74 == https://bugs.ruby-lang.org/issues/19907. I confirmed it with arm32v7/ubuntu:noble docker image on qemu-user-static. ``` root@1294e0e49506:/ruby/tmp/master# for commit in 1c97abaabae6844c861705fd07f532292dcffa74~ 1c97abaabae6844c861705fd07f532292dcffa74; do git checkout $commit & & make -j miniruby >/dev/null 2>&1 && ./miniruby -v && ./miniruby ../a.rb|grep "diff old_objects"; done Previous HEAD position was 081ee3d3550 Add memory leak test for eval kwargs HEAD is now at 2a6917b463f Fix string value in hash literal being forced frozen ruby 3.4.0dev (2024-02-21T02:00:54Z v3_4_0_preview1~1777 2a6917b463) [armv7l-linux-eabihf] GC.stat 1 diff old_objects: 19667 GC.stat 2 diff old_objects: 15357 GC.stat 3 diff old_objects: 23028 GC.stat 4 diff old_objects: 14128 GC.stat 5 diff old_objects: 9381 GC.stat 6 diff old_objects: 20000 GC.stat 7 diff old_objects: 20000 GC.stat 8 diff old_objects: 20000 GC.stat 9 diff old_objects: 20000 Previous HEAD position was 2a6917b463f Fix string value in hash literal being forced frozen HEAD is now at 1c97abaabae De-dup identical callinfo objects ruby 3.4.0dev (2024-02-21T02:55:00Z v3_4_0_preview1~1776 1c97abaaba) [armv7l-linux-eabihf] GC.stat 1 diff old_objects: 85 GC.stat 2 diff old_objects: 41 GC.stat 3 diff old_objects: 42 GC.stat 4 diff old_objects: 42 GC.stat 5 diff old_objects: 42 GC.stat 6 diff old_objects: 42 GC.stat 7 diff old_objects: 42 GC.stat 8 diff old_objects: 42 GC.stat 9 diff old_objects: 42 ``` And the strange ���42��� no longer appears in the latest version. ``` root@1294e0e49506:/ruby/tmp/master# git checkout origin/master && make -j miniruby >/dev/null 2>&1 && ./miniruby -v && ./miniruby ../a.rb|grep "diff old_object s" HEAD is now at 7282adc5a5f [DOC] Doc for File::unlink ruby 4.1.0dev (2026-08-24T00:50:46Z :detached: 7282adc5a5) +PRISM [armv7l-linux-eabihf] GC.stat 1 diff old_objects: 0 GC.stat 2 diff old_objects: 7061 GC.stat 3 diff old_objects: 45 GC.stat 4 diff old_objects: 1 GC.stat 5 diff old_objects: 0 GC.stat 6 diff old_objects: 0 GC.stat 7 diff old_objects: 0 GC.stat 8 diff old_objects: 0 GC.stat 9 diff old_objects: 0 ``` ---------------------------------------- Bug #19970: Eval leaks callcache and callinfo objects on arm32 (linux) https://bugs.ruby-lang.org/issues/19970#change-118635 * Author: larsin (Lars Ingjer) * Status: Closed * ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [armv7l-linux-eabihf] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- The following script demonstrates a memory leak on arm 32 (linux): ``` ruby def gcdiff(n) GC.start if @last_gc_stat puts "GC.stat #{n} diff old_objects: #{GC.stat(:old_objects) - @last_gc_stat}" end @last_gc_stat = GC.stat(:old_objects) end def foo end 10.times do |i| 10_000.times do eval 'foo' end gcdiff(i) puts "Number of live objects: #{GC.stat(:heap_live_slots)}" puts "Memory usage: #{`ps -o rss= -p #{$$}`}" puts end ``` Output: ``` Number of live objects: 41303 Memory usage: 11900 GC.stat 1 diff old_objects: 20037 Number of live objects: 61317 Memory usage: 13604 GC.stat 2 diff old_objects: 20001 Number of live objects: 81317 Memory usage: 14880 GC.stat 3 diff old_objects: 20000 Number of live objects: 101317 Memory usage: 16596 GC.stat 4 diff old_objects: 20000 Number of live objects: 121317 Memory usage: 17248 GC.stat 5 diff old_objects: 20000 Number of live objects: 141317 Memory usage: 18760 GC.stat 6 diff old_objects: 20000 Number of live objects: 161317 Memory usage: 19540 GC.stat 7 diff old_objects: 20000 Number of live objects: 181317 Memory usage: 21752 GC.stat 8 diff old_objects: 20000 Number of live objects: 201317 Memory usage: 21828 GC.stat 9 diff old_objects: 20000 Number of live objects: 221317 Memory usage: 24896 ``` ObjectSpace.count_imemo_objects shows that imemo_callcache and imemo_callinfo are leaking. The issue does not occur on arm64 mac or x86_64 linux with the same ruby version. The issue has also been reproduced with the latest 3.2.2 snapshot (2023-09-30). -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/