[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is my procedure getting GCed?
From: |
Michael Livshin |
Subject: |
Re: Is my procedure getting GCed? |
Date: |
01 May 2001 19:59:01 +0300 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Copyleft) |
Brett Viren <address@hidden> writes:
> 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))"));
the Guile GC only knows about the calling stack and the registers.
if all the instances of ScalarBC are automatic (i.e. sit on the
stack), then there should be no problem. but if you `new' them or
they are static, then you definitely should inform Guile about the
fProc field.
try adding this to the constructor:
scm_protect_object (fProc); // once fProc is intialized, of course
and this to the destructor:
scm_unprotect_object (fProc);
hth, never mind the Totally Random signature,
--mike
--
... it's just that in C++ and the like, you don't trust _anybody_,
and in CLOS you basically trust everybody. the practical result
is that thieves and bums use C++ and nice people use CLOS.
-- Erik Naggum
- Is my procedure getting GCed?, Brett Viren, 2001/05/01
- Re: Is my procedure getting GCed?,
Michael Livshin <=
- 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
- Re: Is my procedure getting GCed?, Marius Vollmer, 2001/05/01