From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: module GC bug Date: Thu, 07 Jul 2005 21:42:00 +0300 Message-ID: <87fyuq1mrr.fsf@zagadka.de> References: <42A8D188.20007@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120762499 21997 80.91.229.2 (7 Jul 2005 18:54:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2005 18:54:59 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 07 20:54:58 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DqbVu-0001GT-AU for guile-devel@m.gmane.org; Thu, 07 Jul 2005 20:54:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DqbXH-0005vl-EV for guile-devel@m.gmane.org; Thu, 07 Jul 2005 14:55:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DqbU2-0004Au-JR for guile-devel@gnu.org; Thu, 07 Jul 2005 14:52:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DqbTv-00046R-IZ for guile-devel@gnu.org; Thu, 07 Jul 2005 14:52:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DqbTs-00040G-O2 for guile-devel@gnu.org; Thu, 07 Jul 2005 14:52:16 -0400 Original-Received: from [213.243.153.36] (helo=smtp3.pp.htv.fi) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DqbQY-0005Tc-OR for guile-devel@gnu.org; Thu, 07 Jul 2005 14:48:51 -0400 Original-Received: from zagadka.ping.de (cs181072157.pp.htv.fi [82.181.72.157]) by smtp3.pp.htv.fi (Postfix) with SMTP id 9BBC927B14F for ; Thu, 7 Jul 2005 21:42:04 +0300 (EEST) Original-Received: (qmail 14616 invoked by uid 1000); 7 Jul 2005 18:42:00 -0000 Original-To: Han-Wen Nienhuys In-Reply-To: <42A8D188.20007@xs4all.nl> (Han-Wen Nienhuys's message of "Fri, 10 Jun 2005 01:32:24 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5141 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:5141 Han-Wen Nienhuys writes: > Hi, > > I've found a memory leak in GUILE. > > The contents of modules are not garbage collected. > > This seems to be related with two errors: > > - scm_stand_in_procs is a hashtable. I believe it should be weak_key > hashtable, just like the scm_object_whash table. For, if a closure is > GC'd, so should it properties. Yes. > - in boot-9.scm, set-module-eval-closure! does > > (set-procedure-property! closure 'module module)) > > So the closure is a key in a weak hash-table, pointing to the module > as a value (using scm_stand_in_procs), the module is always marked > during GC. However, since the module points back to the closure via > the 'eval-closure slot, the key is always marked. Consequently, > neither closure nor module are ever GC'd. > > I've fixed this by introducing a new function (eval-closure-module) > which returns the module of a closure via the eval-closure smob. I think the right fix is to change the weak hashtable marking algorithm to properly cope with circular references like this. I will try this and then come back to you. (I don't know how long this might take since the required changes look to be slightly non-trivial (but entirely possible).) -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel