From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 3C32F1F44D for ; Fri, 1 Mar 2024 07:23:29 +0000 (UTC) Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 45C017EF93; Fri, 1 Mar 2024 07:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1709277794; bh=gOqPcjjlUYkxZhoZCTI+9Kgu51Ol+Z+dPwzhaacMN74=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=UPSls7gylhQUgnELkkK3CCgIE7VxgCUEhbBcH5Yr2Wb7MwHpTM+NbuHCbcIhlYAOv i7Dr4ifrtMkv2dbwCRyTs/FYQsgaEgAD1aZ3knjL9/acq9WsCfT7oD6VbWwtdS6QvX i67y1MapAVJOK1DQqmt4Zz8+36QUQwMpXqU2+i0E= Received: from s.csnrwnwx.outbound-mail.sendgrid.net (s.csnrwnwx.outbound-mail.sendgrid.net [198.37.146.154]) by nue.mailmanlists.eu (Postfix) with ESMTPS id ABB1C7EF3B for ; Fri, 1 Mar 2024 07:23:07 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=Lmh3zR4Y; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=9t7ZV4Ke4mM/LQqjOX0TF23Ew+xLQwaomZmOibtRUYY=; b=Lmh3zR4YnNCjgfYvhEepnn63AbSmdsHvnvAM8kVuOr20igFFFX/fnoBtm9S89bHwkT/x vnA77DRkIsQSvHls9K7oFjDE+9lUgoyMFB96o1fql+6WppQdiw5rlEv2Bz382QAzHiGTLg D8gjZj3GgCocddektQT1hvCPuc5/RM3O/7lzXEBa3jX+0H7xlrlSMAYY2t9V7GHptnkN86 2SMOzRnb7cbr42hdi3OcQ6e3jKlDZqSV03FH/puAq/LyGYAv579I2jqd1OP6BxMQKkkFTO 96cNiIGQMRDQ3zoJOhFGfwCqfVJENSKs7PaTEbMMm4tcYpXxxta6vcZNZYUYzigw== Received: by recvd-canary-5df759b969-8zjl6 with SMTP id recvd-canary-5df759b969-8zjl6-1-65E18259-C 2024-03-01 07:23:05.751644041 +0000 UTC m=+120855.601931290 Received: from herokuapp.com (unknown) by geopod-ismtpd-39 (SG) with ESMTP id E76PlsvpReSCcEsS9UX8WQ for ; Fri, 01 Mar 2024 07:23:05.687 +0000 (UTC) Date: Fri, 01 Mar 2024 07:23:05 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20311 X-Redmine-Issue-Author: MaxLap X-Redmine-Issue-Priority: Normal X-Redmine-Sender: byroot 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-Redmine-MailingListIntegration-Message-Ids: 93590 X-SG-EID: =?us-ascii?Q?Dq8GNIcVqP8cs5uR+EIAabfg3LE9XdC6dZ5KYNrMpf6VzBWG6HqArcu5raQjXL?= =?us-ascii?Q?IGTFdxKHUt7++67+KD54pNYXheirMcsUIf3sdgF?= =?us-ascii?Q?Riq06hS0fn=2F8q87FLqcRKZyi1JNS+4qT1CjwFen?= =?us-ascii?Q?93PmPvPesbzoCVG=2FV0mKO122ZNHlsSAJgW0XDn2?= =?us-ascii?Q?C8nIGiY2VCjf0ELToKqjNMVEo6Lw9xlt7OacsPM?= =?us-ascii?Q?eWzW0sD6crtvfWSv1FOqxJigynLctG3cNB7X5rB?= =?us-ascii?Q?NUTvJrNidQewjyC6vtZTA=3D=3D?= To: ruby-dev@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: OVJW7GLC522H6S3ZLIHNHQDNZEI32366 X-Message-ID-Hash: OVJW7GLC522H6S3ZLIHNHQDNZEI32366 X-MailFrom: bounces+313651-12dc-ruby-dev=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: "Ruby developers (Japanese)" Subject: =?utf-8?q?=5Bruby-dev=3A52079=5D_?= [Ruby master Bug#20311] Struct.new("A") memory leak? List-Id: "Ruby developers (Japanese)" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "byroot (Jean Boussier) via ruby-dev" Cc: "byroot (Jean Boussier)" Issue #20311 has been updated by byroot (Jean Boussier). > Is there any chance for the same module to be added twice? Yes, aliasing isn't uncommon. > Seems fine, but I'm afraid what can happen when an extension library stores rb_path2class("Struct::A") result then remove that constant? Probably this is same for any Ruby-level defined classes/modules. Yes, my reasoning is that it's not reasonable to expect classes created in Ruby to be immortal and immovable like the ones created in C. ---------------------------------------- Bug #20311: Struct.new("A") memory leak? https://bugs.ruby-lang.org/issues/20311#change-107090 * Author: MaxLap (Maxime Lapointe) * Status: Open * ruby -v: 3.3.0 * Backport: 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED ---------------------------------------- The following code gives the impression of a memory leak. ```ruby 10.times do 5000.times do Struct.new("A") Struct.send(:remove_const, :A) end GC.start puts `ps -o rss= -p #{$$}`.to_i end ``` ``` 27868 35324 43400 51472 58676 66144 73764 81196 88512 95752 ``` Is there another location where the struct gets set that I need to clear up for the GC free the memory? Happens in 3.2.2, 3.2.3, 3.3.0, 3.3-head, ruby-head. -- https://bugs.ruby-lang.org/