GNU bug report logs -
#19236
load-compiled procedure leaks memory
Previous Next
To reply to this bug, email your comments to 19236 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#19236
; Package
guile
.
(Sun, 30 Nov 2014 23:31:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Chris Vine <chris <at> cvine.freeserve.co.uk>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sun, 30 Nov 2014 23:31:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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;
}
Information forwarded
to
bug-guile <at> gnu.org
:
bug#19236
; Package
guile
.
(Mon, 17 May 2021 22:26:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 19236 <at> debbugs.gnu.org (full text, mbox):
I don't know if it still leaks but Guile's behavior on loading thousands of
files seems to have regressed further. I get "Too many root sets" after
only about 1900 iterations, after which it aborts.
Primitive-load still works fine.
--
Taylan
This bug report was last modified 2 years and 354 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.