This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Guile GC behaviour
- To: guile at sourceware dot cygnus dot com, scwm-discuss at scwm dot mit dot edu
- Subject: Guile GC behaviour
- From: Greg Badros <gjb at cs dot washington dot edu>
- Date: 27 Sep 1999 16:02:00 -0700
I'd really appreciate some Guile guru's help on this. I am trying to
investigate Scwm's memory leaks a bit more, and I'm confused about the
behaviour I'm seeing in Scwm when I evaluate this s-exp:
(let ((i 0))
(while (< i 100000)
(gc-stats)
(set! i (+ i 1))))
This causes Scwm's process image size to grow dramatically (this is
against guile-1.3.4). We evaluate the string in a fairly contorted way.
I'm also very interested in knowing what might be the "supported" way to
do this very normal task.
We use scwm_safe_eval_str:
SCM scwm_safe_eval_str (char *string)
{
SCM_STACKITEM stack_item;
return scm_internal_cwdr_no_unwind(scwm_body_eval_str, string,
scm_handle_by_message_noexit, "scwm",
&stack_item);
}
and here is scwm_body_eval_str:
static SCM
scwm_body_eval_str (void *body_data)
{
char *string = (char *) body_data;
SCM port = scm_mkstrport (SCM_MAKINUM (0), gh_str02scm(string),
SCM_OPN | SCM_RDNG, "scwm_safe_eval_str");
return scwm_catching_load_from_port (port);
}
and here is scwm_catching_load_from_port:
__inline__ static SCM
scwm_catching_load_from_port (SCM port)
{
SCM expr;
SCM answer = SCM_UNSPECIFIED;
int i = 0;
while (!SCM_EOF_OBJECT_P(expr = scm_read (port))) {
answer = scwm_catching_eval_x (expr);
if (++i % clnsProcessingHook == 0) {
call1_hooks(load_processing_hook, gh_int2scm(i));
}
}
scm_close_port (port);
return answer;
}
and here is scwm_catching_eval_x:
__inline__ static SCM
scwm_catching_eval_x (SCM expr) {
return scm_internal_stack_catch (SCM_BOOL_T, scwm_body_eval_x, &expr,
scwm_handle_error, "scwm");
}
Thanks for any suggestions and/or thoughts about this!
Greg