Actions
Bug #19970
openEval leaks callcache and callinfo objects on arm32 (linux)
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [armv7l-linux-eabihf]
Description
The following script demonstrates a memory leak on arm 32 (linux):
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).
Updated by larsin (Lars Ingjer) about 1 year ago
The issue has also been reproduced on master (ruby 3.3.0dev (2023-10-24 master 60196b4780) [armv7l-linux-eabihf]).
Updated by jhawthorn (John Hawthorn) 9 months ago
I suspect this is the same underlying issue as #19907, but on wider platforms it only occurs with kwargs.
Updated by jhawthorn (John Hawthorn) 9 months ago
- Related to Bug #19907: Method calls with keyword arguments in eval leaks callcache and callinfo objects added
Actions
Like1
Like0Like0Like0