* load procedure seems to leak memory
@ 2014-05-08 17:53 Chris Vine
0 siblings, 0 replies; only message in thread
From: Chris Vine @ 2014-05-08 17:53 UTC (permalink / raw)
To: guile-user
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-05-08 17:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-08 17:53 load procedure seems to leak memory Chris Vine
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).