From: Chris Vine <chris@cvine.freeserve.co.uk>
To: guile-user@gnu.org
Subject: load procedure seems to leak memory
Date: Thu, 8 May 2014 18:53:07 +0100 [thread overview]
Message-ID: <20140508185307.2068aa1d@bother.homenet> (raw)
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 <libguile.h>
#include <stdio.h>
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
reply other threads:[~2014-05-08 17:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140508185307.2068aa1d@bother.homenet \
--to=chris@cvine.freeserve.co.uk \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).