Boost.Coroutine allocates its own call stacks. Does Boehm GC consider pointers on these stacks as roots, and if not how can I make it do that? After a context switch to a coroutine, Boehm terminates the program.
How to use Boost.Coroutine with Boehm GC?
265 Views Asked by AudioBubble At
2
There are 2 best solutions below
1

Presumably the code in Boost.Coroutine saves a pointer to the call stack it allocates, and stores it in one of the "usual" places to store pointers (e.g., some pointer variable).
If that is the case, then yes, the GC will "chase" the pointer from the variable in which it's stored to the call stack, and from there (recursively) through any pointers it contains.
Currently boost doesn't provide a way to hook into segmented stack allocations, so here's a solution for fixed size stacks.
You then provide it when creating the coroutine.