The program loader initializes/loads the text
, data+bss
areas. These are allocated in the process' virtual address space near the beginning. The heap would then grow (after data+bss) towards larger addresses. The stack grows from something large towards lower addresses.
I wonder how the initial value of the stack pointer is determined.
If I ask for the virtual address limit per process (ulimit -v
) I get
virtual memory (kbytes, -v) unlimited
Now, this unlimited
certainly refers to the technical limits put by a finite number of bits available for addressing (on 64 bit Linux I recall 48 bits?!)
So, is it that simple that unless a different ulimit
applies the stack pointer is roughly initialized to (start of vmem + 2^48 bits)?
This is a highly platform dependent question, and depends on the bit-ness of the program you are running, the operating system version in use, system configuration options, whether or not the program is single or multi-threaded, and other factors:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With