Why bother with stack sizes?

75 views Asked by At

Why bother, really?

On 64-bit architectures OS can assign ludicrously large address space to each stack, then map new pages to the virtual memory on demand.

So why do we have limited stack sizes?

Is it just to be able to better identify segfaults?

Or is it just to keep backward compatibility with architectures with no virtual memory?

This is especially interesting in the context of split stacks: If the stacks were unlimited, split stacks would be a solution to a non-existent problem. Or am I wrong?

1

There are 1 answers

0
irvnriir On

Windows does grow the amount of initialized Stack space, i would assume that Linux too . You can provide "ludicrously large" size limit for a Stack . And unless that will grow actual memory use, by storing correlated amount of metadata . You should be just fine .

Is it just to be able to better identify segfaults?

Or is it just to keep backward compatibility with architectures with no virtual memory?

Pretty much the both, yeah .