The stack grows up negatively The stack has a size is:
- 1MB on Windows
- 4MB on Linux https://www.youtube.com/watch?v=CRTR5ljBjPM Organized memory where program data resides. Stores:
- Local variables of the active function
- Return address pointer
- Local variables of the caller function and its caller function, so on so forth
Stack Representations
C Initial Program Run Stack
Function Stack
Drawing 2025-06-24 20.46.23.excalidraw
⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠
Text Elements
Ret Addr
esp
0x3000
0x4000
first argument
older variables…
Function Locals
Function
second argument
n bytes
4 bytes
n bytes
n bytes
Function With Arguments
Link to original
- Oftentimes, the return address is 4 bytes, so 4 bytes of junk are used as padding