vibe.d beta banner
get vibe.d

Asynchronous I/O that doesn’t get in your way, written in D

Function setTaskStackSize

Sets the stack size to use for tasks.

void setTaskStackSize (
  ulong sz

The default stack size is set to 512 KiB on 32-bit systems and to 16 MiB on 64-bit systems, which is sufficient for most tasks. Tuning this value can be used to reduce memory usage for large numbers of concurrent tasks or to avoid stack overflows for applications with heavy stack use.

Note that this function must be called at initialization time, before any task is started to have an effect.

Also note that the stack will initially not consume actual physical memory - it just reserves virtual address space. Only once the stack gets actually filled up with data will physical memory then be reserved page by page. This means that the stack can safely be set to large sizes on 64-bit systems without having to worry about memory usage.


Sönke Ludwig


© 2012-2020 Sönke Ludwig


Subject to the terms of the MIT license, as written in the included LICENSE.txt file.