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=-3.0 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 5917B1F4BD for ; Mon, 7 Oct 2019 22:07:23 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id ABC88120A0D; Tue, 8 Oct 2019 07:07:14 +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 339E7120A0C for ; Tue, 8 Oct 2019 07:07:12 +0900 (JST) Received: by filter0121p3las1.sendgrid.net with SMTP id filter0121p3las1-13426-5D9BB710-9B 2019-10-07 22:07:13.044685607 +0000 UTC m=+357548.844962489 Received: from herokuapp.com (unknown [54.158.92.1]) by ismtpd0007p1iad2.sendgrid.net (SG) with ESMTP id Q0jiAvLOSRCSsB0bXZYwuA for ; Mon, 07 Oct 2019 22:07:12.785 +0000 (UTC) Date: Mon, 07 Oct 2019 22:07:13 +0000 (UTC) From: sam.saffron@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70855 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=2Fa5aksj98ZWP5TI65WNxlPD5W0jgcrF?= =?us-ascii?Q?=2FehDExNKftzyW+gznIf1edlu6acIyBNz3lq+PGS?= =?us-ascii?Q?KybZXmzd2iUJQYjB7Qaru8issuoYrJ1K5WISHkQ?= =?us-ascii?Q?SopE5sdEVF9OnwHEzxtVpz3Yk6i3klGdAtz7dFs?= =?us-ascii?Q?26dNwbdWSZ3Bp8z96OSmagzwVdqq9j3jepQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95268 Subject: [ruby-core:95268] [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). 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/