[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
load procedure seems to leak memory
From: |
Chris Vine |
Subject: |
load procedure seems to leak memory |
Date: |
Thu, 8 May 2014 18:53:07 +0100 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- load procedure seems to leak memory,
Chris Vine <=