Search code examples
memoryheap-memoryterminologystack-memory

Is the stack in memory actually a stack?


In memory there is a section called stack that starts at the top and grows down towards the heap. Is this stack the same thing as a LIFO stack? Is the heap at the bottom a FIFO?

When you do "push" and "pop", does that alter the stack in memory?


Solution

  • The stack is in fact a LIFO stack.

    It's created by the program itself while the program is running. The code that controls the stack is created at compilation time.

    Farther reading:

    Hardware Stacks

    Call Stack

    X86 Addressing Modes