From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.user Subject: load procedure seems to leak memory Date: Thu, 8 May 2014 18:53:07 +0100 Message-ID: <20140508185307.2068aa1d@bother.homenet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1399571621 5112 80.91.229.3 (8 May 2014 17:53:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 17:53:41 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu May 08 19:53:34 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WiSVh-0001nv-JF for guile-user@m.gmane.org; Thu, 08 May 2014 19:53:33 +0200 Original-Received: from localhost ([::1]:48581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiSVh-0007Lg-7B for guile-user@m.gmane.org; Thu, 08 May 2014 13:53:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiSVR-0007LW-QN for guile-user@gnu.org; Thu, 08 May 2014 13:53:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiSVI-0003QK-9e for guile-user@gnu.org; Thu, 08 May 2014 13:53:17 -0400 Original-Received: from smtpout5.wanadoo.co.uk ([80.12.242.80]:40099 helo=smtpout.wanadoo.co.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiSVI-0003Od-3Z for guile-user@gnu.org; Thu, 08 May 2014 13:53:08 -0400 Original-Received: from bother.homenet ([95.146.111.191]) by mwinf5d69 with ME id zVt31n00647pFd303Vt3UD; Thu, 08 May 2014 19:53:05 +0200 X-ME-Helo: bother.homenet X-ME-Date: Thu, 08 May 2014 19:53:05 +0200 X-ME-IP: 95.146.111.191 Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with ESMTP id D48638C43B for ; Thu, 8 May 2014 18:53:07 +0100 (BST) X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.23; i686-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.12.242.80 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11251 Archived-At: Hi, I have noticed that guile-2.0's load procedure seems to leak memory. This can be observed by the following, which on all the 32-bit machines on which I have tested (using guile-2.0.9 and guile-2.0.11) exhausts the scheme memory heap at around 65,000 loads. (let loop ([count 0]) (load "./test-file.scm") (when (= (modulo count 100) 0) (display count) (display " ")) (when (< count 256000) (loop (1+ count)))) In this test case, test-file.scm is a file containing a single scheme false (#f) expression. The same can be observed with a similar C implementation: #include #include void *func (void *data) { scm_c_eval_string ("(load \"./test-file.scm\")"); return NULL; } int main (void) { int count; for(count = 0; count < 256000; ++count) { scm_with_guile (func, NULL); if (!(count % 100)) { printf ("%d ", count); fflush (stdout); } } return 0; } primitive-load does not leak. Is there anything I can do to encourage the VM to release the stale memory? In the test case, running (gc)/scm_gc() by hand every 100th iteration doesn't help unfortunately. Chris