How to pass stack size?

Now suppose I have a small stack and I want to pass the size of the stack to the compiler to force it to use the heap more to avoid stack overflow. Is this possible?

The compiler doesn't choose where to allocate based on stack size. If you want to or something on the be on the heap, use Box<T> instead of T.

Choosing the (main thread) stack size, if you do want to change it, depends on the platform, and generally is a linker flag.

1 Like

While true, this will not

pass the size of the stack to the compiler to force it to use the heap more to avoid stack overflow

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.