[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is my procedure getting GCed?
From: |
Brett Viren |
Subject: |
Is my procedure getting GCed? |
Date: |
Tue, 1 May 2001 12:45:38 -0400 (EDT) |
Hi all,
I am (still) working on this GTK-- + Guile (v1.4) application about
which I have asked questions before. My current problem is I think
the GC is killing stuff out from under me.
The program has a C++ class which stores a Guile procedure as an SCM
which it gets at construction:
class ScalarBC {
// ...
SCM fProc;
}
// ...
ScalarBC my_sbc(gh_eval_str("(lambda () (random:uniform))"));
In response to SIGUSR2 signals, which come about 1/sec, the code
breaks out of GTK--'s main loop and, among other things, calls the
saved procedure in the following method:
void ScalarBC::Update(void)
{
// scm_gc();
if (!gh_procedure_p(fProc)) {
cerr << "ScalarBC::Update: Have no procedure with which to update\n";
return;
}
SCM result = gh_call0(fProc);
if (!gh_number_p(result)) {
cerr << "ScalarBC::Update: Procedure doesn't return number\n";
return;
}
double x = gh_scm2double(result);
fBCData.Update(x);
}
The problem is that after about 100 itterations `my_proc' is no longer
a procedure according to `gh_procedure_p()'. The exact number of
iterations depends on how many such functions I have.
But, more telling, if I uncomment the `scm_gc()' call, then I
immediately fail the `gh_procedure_p()' check.
Am I doing something wrong here? Maybe it is not okay to copy SCM
values around?
Is there a way to force Guile not to GC this procedure?
Thanks for any insights,
-Brett.
- Is my procedure getting GCed?,
Brett Viren <=
- Re: Is my procedure getting GCed?, Michael Livshin, 2001/05/01
- Re: Is my procedure getting GCed?, Brett Viren, 2001/05/01
- Re: Is my procedure getting GCed?, Bill Gribble, 2001/05/01
- Re: Is my procedure getting GCed?, Michael Livshin, 2001/05/01
- Re: Is my procedure getting GCed?, Dirk Herrmann, 2001/05/07
- Re: Is my procedure getting GCed?, Michael Livshin, 2001/05/07
- Re: Is my procedure getting GCed?, Marius Vollmer, 2001/05/14
- Re: Is my procedure getting GCed?, Dirk Herrmann, 2001/05/14
- Re: Is my procedure getting GCed?, Dirk Herrmann, 2001/05/15
- Re: Is my procedure getting GCed?, Brett Viren, 2001/05/01