2 ms·
Stack allocation doesn't make a big difference. To see this, consider the working set of a server application vs. the number of threads. Assuming a stack size c
by pron 2y ago
Stack allocation doesn't make a big difference. To see this, consider the working set of a server application vs. the number of threads. Assuming a stack size circa 1MB, thousands of threads are needed to account for a significant portion of the working set. Go and Java's user-mode threads certainly make it more interesting, but not enough to dominate heap objects (arena allocation, which is particularly nice in Zig) is a different matter, and can have a bigger impact).
The main reason for Java's Project Valhalla is not stack allocation, as it has too little impact, but arrays-of-structs on the heap. These matter not so much for their memory-management aspect, but the rate of cache-misses.