GNU logs - #19236, boring messages


Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19236: load-compiled procedure leaks memory
Resent-From: Chris Vine <chris@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Sun, 30 Nov 2014 23:31:02 +0000
Resent-Message-ID: <handler.19236.B.14173902418532 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 19236
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: 
To: 19236 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.14173902418532
          (code B ref -1); Sun, 30 Nov 2014 23:31:02 +0000
Received: (at submit) by debbugs.gnu.org; 30 Nov 2014 23:30:41 +0000
Received: from localhost ([127.0.0.1]:50217 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XvDwu-0002DX-EY
	for submit <at> debbugs.gnu.org; Sun, 30 Nov 2014 18:30:40 -0500
Received: from eggs.gnu.org ([208.118.235.92]:49303)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <chris@HIDDEN>) id 1XvDws-0002DM-Sy
 for submit <at> debbugs.gnu.org; Sun, 30 Nov 2014 18:30:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <chris@HIDDEN>) id 1XvDwj-0005zt-14
 for submit <at> debbugs.gnu.org; Sun, 30 Nov 2014 18:30:38 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:50713)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <chris@HIDDEN>) id 1XvDwi-0005zi-Tl
 for submit <at> debbugs.gnu.org; Sun, 30 Nov 2014 18:30:28 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50885)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <chris@HIDDEN>) id 1XvDwb-00006M-7P
 for bug-guile@HIDDEN; Sun, 30 Nov 2014 18:30:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <chris@HIDDEN>) id 1XvDwR-0005j1-Ti
 for bug-guile@HIDDEN; Sun, 30 Nov 2014 18:30:21 -0500
Received: from smtpout3.wanadoo.co.uk ([80.12.242.59]:32128
 helo=smtpout.wanadoo.co.uk) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <chris@HIDDEN>) id 1XvDwR-0005im-NG
 for bug-guile@HIDDEN; Sun, 30 Nov 2014 18:30:11 -0500
Received: from laptop.homenet ([95.146.110.225]) by mwinf5d37 with ME
 id MzWA1p0084rpotr03zWAd0; Mon, 01 Dec 2014 00:30:11 +0100
X-ME-Helo: laptop.homenet
X-ME-Date: Mon, 01 Dec 2014 00:30:11 +0100
X-ME-IP: 95.146.110.225
Received: from bother.homenet (localhost [127.0.0.1])
 by laptop.homenet (Postfix) with ESMTP id 0AAFF8B70A
 for <bug-guile@HIDDEN>; Sun, 30 Nov 2014 23:30:10 +0000 (GMT)
Date: Sun, 30 Nov 2014 23:30:09 +0000
From: Chris Vine <chris@HIDDEN>
Message-ID: <20141130233009.0e596015@HIDDEN>
X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; i686-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

The load-compiled procedure leaks memory in guile-2.0.11 as
demonstrated by the attached test case.  It should be used in
conjunction with a file 'test-file.scm' which contains only a single #f
expression.  This test case should be invoked either with the "pload"
or "load" option.  If invoked with the pload option, it will invoke
primitive-load, which accumulates no additional memory while executing,
and will execute normally to the end of its iterations.  If invoked
with the load option, on my 32-bit machine it will steadily accumulate
a memory leak before running out of memory on consuming approximately
300M memory, after about 65,000 iterations.  The memory leak seems to
arise in guile's load-compiled procedure.

The question which might be asked is "Would any sane person ever want
to invoke the load (or load-compiled) procedures more than a few times
in a practical program?".  The answer to this question is "Yes", if
guile is being used as an extension framework for a C or C++ program,
and it executes guile extensions as individual tasks.

Test case:

----------------------------- snip -----------------------------

/* compile with 'gcc -O2 -Wall `pkg-config --cflags --libs guile-2.0` -o test-guile' */

#include <libguile.h>
#include <stdio.h>
#include <string.h>

int load;

void* func (void* data)
{

  switch (load)
    {
      case 0:
	scm_c_eval_string("(primitive-load \"test-file.scm\")");
	break;
      default:
	scm_c_eval_string("(load \"./test-file.scm\")");
    }

  return NULL;
}

int main (int argc, char *argv[])
{

  int count;

  if (argc != 2
      || (strcmp (argv[1], "pload") &&
	  strcmp (argv[1], "load")))
    {
      puts ("Usage: test-guile load | pload");
      exit (1);
    }

  if (!strcmp (argv[1], "load"))
    {
      puts("Using load");
      load = 1;
    }
  else
    puts("Using primitive-load");

  for (count = 0; count < 256000; ++count)
    {
      scm_with_guile(func, NULL);

      if (!(count % 100)) {
	printf("%d ", count);
	fflush(stdout);
      }
    }

  puts("");
  return 0;
}




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Chris Vine <chris@HIDDEN>
Subject: bug#19236: Acknowledgement (load-compiled procedure leaks memory)
Message-ID: <handler.19236.B.14173902418532.ack <at> debbugs.gnu.org>
References: <20141130233009.0e596015@HIDDEN>
X-Gnu-PR-Message: ack 19236
X-Gnu-PR-Package: guile
Reply-To: 19236 <at> debbugs.gnu.org
Date: Sun, 30 Nov 2014 23:31:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-guile@HIDDEN

If you wish to submit further information on this problem, please
send it to 19236 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
19236: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19236
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems



Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.