[ruby-core:95404] [Ruby master Feature#16245] Add interfaces to count and measure size all IMEMO objects
From:
sam.saffron@...
Date:
2019-10-17 21:16:39 UTC
List:
ruby-core #95404
Issue #16245 has been updated by sam.saffron (Sam Saffron).
Yes!
ObjectSpace.memsize_of_imemo_objects sounds perfect to me.
I also support adding `ObjectSpace.each_iseq` which seems the simplest way to get iteration working.
I get the concern about not wanting to pollute MRI with MRI specific logic directly in ObjectSpace, but given we already have ObjectSpace.count_imemo_objects it feels a bit too late for this case.
----------------------------------------
Feature #16245: Add interfaces to count and measure size all IMEMO objects
https://bugs.ruby-lang.org/issues/16245#change-82131
* Author: sam.saffron (Sam Saffron)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Koichi introduced an experimental gem: https://github.com/ko1/iseq_collector
It allows:
ObjectSpace.each_iseq{|iseq| ...}
ObjectSpace.count_iseq #=> Integer
ObjectSpace.memsize_of_all_iseq (should not generate RubyVM::InstructionSequence wrappers for IMEMOs)
Since the wrapper object RubyVM::InstructionSequence is lazily allocated, ObjectSpace.each_object does not find these IMEMOs unless they have been wrapped. This design is good and conserves memory.
`count_iseq` and `memsize_of_all_iseq` are very powerful metrics most large Ruby deployments can use to automatically detect method leaks introduced via meta programming. These issues are invisible now short of walking a heap dump.
Can we add the new interface into 2.7?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>