It is not uncommon during development to run into stack overflows. This occurs due to a few factors, such as placing large objects in the stack, calling asynchronous functions that result in large futures placed on the stack, and deep calls.
Proposal
Ideally stack usage should be measured to find the places in the code that are using most of the stack. Some ideas that might reduce the usage include:
splitting large functions into smaller functions so that each part uses a small amount of stack memory
grouping many function parameters into fewer types, so that they can be passed as a single reference
running more asynchronous tasks as actors, so that they have their own task with a shallower stack in the executor thread
placing large types into heap-memory containers (like Box, Rc, Arc, Vec, etc.)
Motivation
It is not uncommon during development to run into stack overflows. This occurs due to a few factors, such as placing large objects in the stack, calling asynchronous functions that result in large futures placed on the stack, and deep calls.
Proposal
Ideally stack usage should be measured to find the places in the code that are using most of the stack. Some ideas that might reduce the usage include:
Box
,Rc
,Arc
,Vec
, etc.)