This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Why does the GC frees my function?


Miroslav Silovic <silovic@zesoi.fer.hr> a écrit :

> GC doesn't know about alpha binding, so it can't mark SCMs pointed
> from it as used. One way to make it do so is to allocate alpha binding
> as a protected Scheme vector:
> 
> SCM *alpha_binding;
> 
> void init_alpha_binding
> {
> 	SCM v = scm_make_vector (SCM_MAKINUM(26), SCM_BOOL_F);
> 	scm_protect_object (v);
> 	alpha_binding = SCM_VELTS(v);
> }

Ok. But why it also frees variables i allocate from scheme?

For example i make a hook:

init_hook = scm_make_named_hook ("init", 1);

and i add a function to it:

(add-hook! init
 	   (lambda (str)
	     (display
	      (string-append "Welcome to " str ".\n"))))

and then, when i run the hook, guile yalles at me:

ERROR: In procedure string-append:
ERROR: Wrong type argument: #<freed cell 0x401946b8; GC missed a reference>

-- 
  Si la connerie était cotée en bourse,tu serais incarcéré pour
  délit d'initié...
  -+- EB in: Guide du Cabaliste Usenet - Les initiés ont la cote -+-

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]