guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static variables with scheme objects


From: sig
Subject: Re: static variables with scheme objects
Date: Wed, 16 Jul 2003 15:43:47 -0400
User-agent: Mutt/1.2.5.1i

I will accept being labeled paranoid with my thread code, but
consider the following:

lets say I do this:

global_list =
scm_permanent_object(scm_list_2(make_giant_smob1(),
                                make_giant_smob2()));

make_giant_smob2() runs and creates a smob. Then
make_giant_smob1() runs and it doesn't have enough memory to
create it, so it runs the gc, which finds smob2 without
references, frees smob2, alloctaes somb1 and returns smob1. Then
we try to make a list of one good object and one fat pointer to
nowhere. So even without other threads running its still
possible to have the GC run.

cya
.sig

On Wed, Jul 16, 2003 at 03:20:16PM -0400, Paul Jarc wrote:
> > If the garbage collector gets run after scm_make_mutex but before
> > scm_permanent_object,
> 
> Do you have multiple threads running already when your init function
> is called?  If not, there's nothing to worry about; there's nothing in
> this thread that will trigger the garbage collector in that window.
> If you do have multiple threads already, then I don't know.
> 
> 
> paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]