MessyCode MessyCode - 1 year ago 114
C++ Question

C++ - expand stack at runtime

Possible Duplicate:

Printing the stack trace in C++ (MSVC)?

How I can expand stack automatically when needed? (Until max I decide)

I am trying to create something that gets function pointer (Random one, I can't know what the function really needs) and create fiber with it.
But I need to create a lot of fibers but when they take more then the default I want it to expand automatically ,until max I decide.

REASON: I need to create a lot of fibers and if I create with them large stack then It'll take a lot memory too in the RAM. But if I'll create small stack it'll throw exception. (Stack Overflow)

But there should be large stack and small stack ,then I need to expand it automatically at run-time.

jxh jxh
Answer Source

If you use CreateFiberEx to create your fibers, you can use a small commit stack size, and a larger reserve stack size. Note, however, that whatever you specify for reserve is removed from the total memory available from the system. But, it is not committed to RAM unless you need it. Details are described here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download