Re: GC and Coroutines
Juan Wajnerman <[email protected]>
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <[email protected]> |
No luck... same problem. On Jan 28, 2014, at 6:01 PM, Basile Starynkevitch <[email protected]> wrote: > On Tue, 2014-01-28 at 17:36 -0300, Juan Wajnerman wrote: >> 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. > > > Perhaps try with: > > > void real_coroutine_body(struct GC_stack_base *sbase, void*realarg) > { > int i; > for (i = 0; i < 1000; ++i) > { > printf("%d\n", i); > GC_malloc(1024); > } > } > > void coroutine_stub(void *arg) > { > GC_call_with_stack_base (real_coroutine_body, arg) > } > > > > #define STACK_SIZE 32 * 1024 > > int main(int argc, char const *argv[]) { > GC_init(); > void *stack = GC_malloc(STACK_SIZE); > coroutine_t c = co_create(coroutine_stub, 0, stack, STACK_SIZE); > co_call(c); > return 0; > } > > > ########### > > I did not test that code. Please tell us (on the list) if it works or > not. > > 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} *** > >