From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id AD4641F4C0 for ; Thu, 17 Oct 2019 21:16:49 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id ABD3F120B01; Fri, 18 Oct 2019 06:16:40 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 54001120B00 for ; Fri, 18 Oct 2019 06:16:38 +0900 (JST) Received: by filter0061p3iad2.sendgrid.net with SMTP id filter0061p3iad2-31333-5DA8DA36-AF 2019-10-17 21:16:38.976516879 +0000 UTC m=+608533.989106826 Received: from herokuapp.com (unknown [54.167.110.97]) by ismtpd0024p1mdw1.sendgrid.net (SG) with ESMTP id N3AeRQOLSiGlt2F4D8V7gg for ; Thu, 17 Oct 2019 21:16:38.956 +0000 (UTC) Date: Thu, 17 Oct 2019 21:16:39 +0000 (UTC) From: sam.saffron@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70993 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16245 X-Redmine-Issue-Author: sam.saffron X-Redmine-Sender: sam.saffron X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?GD31AXMrLYtZC3ZmvheLkg5nAqKYtjT=2Fa5aksj98ZWNRYLk2rRjOPwabIq=2FZFG?= =?us-ascii?Q?Ph7PwX3JbypyFgsRmwBRF0ABBdR6ZH8ep1dp0SQ?= =?us-ascii?Q?CwRBq8OlJ5k8bbF088rBOb8mx2EtQNGU2cEw+UG?= =?us-ascii?Q?4+vw6WzetLjm+xsW8t6TH5z3HYco=2FHT5hrC08rx?= =?us-ascii?Q?TNeViRxqIJFlLgj+eGio6eRPCSDDVTh74fA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95404 Subject: [ruby-core:95404] [Ruby master Feature#16245] Add interfaces to count and measure size all IMEMO objects X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" 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/