From: sam.saffron@... Date: 2019-10-07T22:07:13+00:00 Subject: [ruby-core:95268] [Ruby master Feature#16245] Add interfaces to count and measure size all IMEMO objects Issue #16245 has been updated by sam.saffron (Sam Saffron). An alternative design could be to add 1 extra object to the heap RubyVM::NonMaterializedInstructionSequence Then `each_object` could include it and we could use that to measure size of all IMEMOs that are not materialized yet. Advantage here is that naive `memsize_of` all objects will return all the memory. ---------------------------------------- Feature #16245: Add interfaces to count and measure size all IMEMO objects https://bugs.ruby-lang.org/issues/16245#change-81944 * 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: