On Saturday, 9 July 2016 at 13:48:41 UTC, Dicebot wrote:
On 07/09/2016 02:48 AM, ikod wrote:
If I made a wrong guess and
ask for too small stack then programm may crash. If I ask for
too large
stack then I probably waste resources.
Nope, this is exactly the point. You can demand crazy 10 MB of
stack for each fiber and only the actually used part will be
allocated by kernel.
Remember that virtual address space is limited on 32-bit
platforms. Thus spawning 2000 threads 1 MB stack each will occupy
all available VA space and you'll get an allocation failure (even
if the real memory usage is low).