Re: GC and Coroutines

Kjetil Matheussen <[email protected]>
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <CAC6niELfALYQXw9YqiV=MZzje6cfZnGcm0bN8OiosO4RCciV1g@mail.gmail.com>
On Tue, Jan 28, 2014 at 10:51 PM, Basile Starynkevitch
<[email protected]> wrote:
> On Tue, 2014-01-28 at 18:35 -0300, Juan Wajnerman wrote:
>> I made the stack and the coroutine variables (might be the same value, right?) as global but it still crashes.
>> Something I noticed is that when I call co_create() without a stack (it allocates its own stack) it works fine if I didn't call GC_malloc() before.
>> In other words, it crashes if I call GC_malloc() in the main function.
>>
>
>
> Show the actual code if possible ... I'm not sure to understand you
> well..
>

If you don't supply your own stack to co_create, it will create it's own,
probably using malloc. I.e. this will happen:

stack = malloc(STACK_SIZE);

This works, since the reason it crashed before was that the
stack (allocated with GC_malloc) was garbage collected.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.