开发者

Coroutines with a growing stack in C

I want to use coroutines in C (Linux), but I don't want to waste lots of space for each one. I'm wondering about allocating the space for the stack with mmap开发者_如何转开发() given MAP_GROWSDOWN, but I read somewhere that it was broken, do you know any more about this?


but I don't want to waste lots of space for each one

Don't worry about it. Your coroutine can have a large stack but it will not cause any performance or resource problems unless the stack is actually used. The logical pages of memory will not be assigned physical pages until that point. And if it is used, well you needed it then didn't you?

Just use a decent sized stack and have done with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜