[Gc] GC and Coroutines

Juan Wajnerman jwajnerman at manas.com.ar
Tue Jan 28 12:36:33 PST 2014

I'm not sure if I understand how I'm supposed to use the GC_stack_base info. I tried to call GC_add_root using the mem_base but with no luck so far.

Here is a small example of what I'm trying to run: https://gist.github.com/waj/8675658
In my machine it crashes after 60 or 70 iterations.

The stack space allocated for the coroutine is also allocated with the GC so it shouldn't be necessary to register that area, right?

I guess this has to be something related with the fact that PCL is using setjmp/longjmp or ucontext functions.

- Juan

On Jan 28, 2014, at 12:47 PM, Basile Starynkevitch <basile at starynkevitch.net> wrote:

> On Tue, 2014-01-28 at 10:12 -0300, Juan Wajnerman wrote:
>> I'm trying to use the GC together with this coroutine
>> library: http://xmailserver.org/pcl.html
>> But when the GC tries to free some memory running inside a coroutine
>> it crashes.
>> I guess the problem happens because other coroutine stacks are
>> inaccessible during coroutine execution but I don't know how to fix
>> this.
>> Does anyone have some tips or tell me at least how could I debug this
>> issue?
> You probably should use the struct GC_stack_base (probably in the first
> routine passed to co_create ...) and use GC_call_with_stack_base
> there
> Hope that this helps! Please tell us if it does (I am not sure at all)!
> Cheers.
> -- 
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mine, sont seulement les miennes} ***

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20140128/54543ff5/attachment.htm

More information about the Gc mailing list