What is Stack frame?

The area reserved on the stack each time a function is called. It holds the return address, saved registers and local variables and is freed when the function returns.

Field: ISA & Assembly

Stack frame in the explanations

Questions that mention Stack frame (5)

  1. A function that calls no other functions (a leaf function) often does not need to save ra on the stack. Why?
  2. What is the purpose of executing "addi sp, sp, -16" at the start of a RISC-V function?
  3. The code above is the start (prologue) of a function. What does it do?
  4. What is the effect of applying tail-call optimization to the final recursive call in the function above?
  5. Where is a non-static local (automatic) variable declared inside a C function placed at run time?

Related terms

Return address Leaf function Stack pointer Addressing mode Application binary interface (ABI) Assembler Branch delay slot Callee-saved register Caller-saved register Calling convention

Back to the glossary