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 05CC41F4BD for ; Tue, 8 Oct 2019 19:28:18 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id F37E1120A2F; Wed, 9 Oct 2019 04:28:07 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id DA162120A2E for ; Wed, 9 Oct 2019 04:28:05 +0900 (JST) Received: by filter0183p3mdw1.sendgrid.net with SMTP id filter0183p3mdw1-3192-5D9CE34A-1F 2019-10-08 19:28:10.293255569 +0000 UTC m=+435439.355938368 Received: from herokuapp.com (unknown [54.157.57.165]) by ismtpd0061p1mdw1.sendgrid.net (SG) with ESMTP id iG8M5YlVRWqiQyBZXXEPXA for ; Tue, 08 Oct 2019 19:28:10.272 +0000 (UTC) Date: Tue, 08 Oct 2019 19:28:10 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70869 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16245 X-Redmine-Issue-Author: sam.saffron X-Redmine-Sender: Eregon 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?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr0Z6r63ZHLJANQ7PlkSEv?= =?us-ascii?Q?ZQYI7YlJ2Oq0Jjsjw0VDnOe0YspiN8jRCgYMLJC?= =?us-ascii?Q?xfjskHKwrmNUlG3LGmAEGx45DL8hNq1Zl14VrnU?= =?us-ascii?Q?d0VLhtWG4zPcvOWTPMAHCwzmFstYRRzIq6nzX26?= =?us-ascii?Q?FoomFYHRmA8Yo2nWMG91auzc89UhcJ2RylA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95282 Subject: [ruby-core:95282] [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 Eregon (Benoit Daloze). Do you think it would be possible for this new API to not rely on whether there is bytecode/iseqs? That way, it could be implemented on other Ruby implementations. Is the main purpose to be able to estimate memory used by loaded Ruby code (methods)? A count of reachable methods' internal representations (iseq, AST, etc) would be a metric that is likely easy to provide work for all Ruby implementations. ---------------------------------------- Feature #16245: Add interfaces to count and measure size all IMEMO objects https://bugs.ruby-lang.org/issues/16245#change-81960 * 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/