From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id E4C0F1F03A2 for ; Mon, 20 Apr 2009 12:50:55 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 1EB7CEA51DA for ; Mon, 20 Apr 2009 12:43:50 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 757991FA004 for ; Mon, 20 Apr 2009 12:43:50 +0900 (JST) X-Virus-Scanned: amavisd-new at funfun.nagaokaut.ac.jp Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by localhost (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6JksGH6YE1oD for ; Mon, 20 Apr 2009 12:43:50 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 54D571FA001 for ; Mon, 20 Apr 2009 12:43:50 +0900 (JST) Received: from carbon.ruby-lang.org (carbon.ruby-lang.org [221.186.184.68]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 4374395241E for ; Mon, 20 Apr 2009 12:43:48 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1]) by carbon.ruby-lang.org (Postfix) with ESMTP id D09ED3C21D3A9; Mon, 20 Apr 2009 12:43:46 +0900 (JST) Received: from parasect1.netlab.jp (parasect1.netlab.jp [210.251.121.9]) by carbon.ruby-lang.org (Postfix) with ESMTP id 119723C21D3A6 for ; Mon, 20 Apr 2009 12:43:41 +0900 (JST) Received: from x61.netlab.jp (unknown [IPv6:2001:268:306:1:21d:72ff:fe86:6809]) by parasect1.netlab.jp (Postfix) with ESMTP id EE91E1CDCA50 for ; Mon, 20 Apr 2009 12:43:40 +0900 (JST) Received: from matz by x61.netlab.jp with local (Exim 4.69) (envelope-from ) id 1LveMW-0001Jx-1i for ruby-core@ruby-lang.org; Mon, 20 Apr 2009 06:15:40 +0900 Delivered-To: ruby-core@ruby-lang.org Date: Mon, 20 Apr 2009 12:43:41 +0900 Posted: Mon, 20 Apr 2009 06:15:40 +0900 From: Yukihiro Matsumoto Reply-To: ruby-core@ruby-lang.org Subject: [ruby-core:23258] Re: [Bug #1392] Object#extend leaks memory on Ruby 1.9.1 To: ruby-core@ruby-lang.org Message-Id: In-Reply-To: <49ea51a1deec_323f5bb5b52104e@redmine.ruby-lang.org> X-ML-Name: ruby-core X-Mail-Count: 23258 X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post) X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address ruby-core-ctl@ruby-lang.org; help= User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.3 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI) X-Spam-Checker-Version: SpamAssassin 3.1.7-deb3 (2006-10-05) on carbon.ruby-lang.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=7.0 tests=BAYES_20,CONTENT_TYPE_PRESENT, DATE_IN_PAST_06_12,EXIM_ERRWARN,FAKEDWORD_VERTICALLINE autolearn=disabled version=3.1.7-deb3 Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-Id: ruby-core.ruby-lang.org List-Software: fml [fml 4.0.3 release (20011202/4.0.3)] List-Post: List-Owner: List-Help: List-Unsubscribe: Hi, In message "Re: [ruby-core:23252] [Bug #1392] Object#extend leaks memory on Ruby 1.9.1" on Sun, 19 Apr 2009 07:18:18 +0900, Muhammad Ali writes: | |Bug #1392: Object#extend leaks memory on Ruby 1.9.1 |http://redmine.ruby-lang.org/issues/show/1392 |A few bytes are leaked every time Object#extend is called, here is a sample 1.9.1 script It does not leak memory. the version that use #extend allocates internal class-like object for each hash object, so that it allocates lot more objects than #include version, thus requires more heap space to be allocated. The GC does reclaim the unused objects, but it may not be able to return heap space to the underlying OS. To confirm there's no memory leak, replace sleep with GC.start p ObjectSpace.count_objects It prints the number of live objects, e.g. {:TOTAL=>17185, :FREE=>9590, :T_OBJECT=>5, :T_CLASS=>474, :T_MODULE=>20, :T_FLOAT=>6, :T_STRING=>1551, :T_REGEXP=>10, :T_ARRAY=>23, :T_HASH=>3, :T_BIGNUM=>2, :T_FILE=>3, :T_DATA=>28, :T_COMPLEX=>1, :T_NODE=>5451, :T_ICLASS=>18} matz.