Stack Frame
PronunciationSTAK fraym
Definition
A stack frame is the block of memory created on the call stack for one function call. It holds that call's arguments, local variables and the place to return to.
Where you hear it
In debuggers and tracebacks (each line is a frame), recursion discussions and explanations of how functions run.
Examples
Each recursive call adds a new stack frame.
In the debugger, select the frame to see its local variables.
The debugger shows each stack frame, and the first one is the function that crashed.
Common mistake
Thinking local variables are shared between calls. Each call gets its own frame and its own copies.
Don't confuse with
The call stack, which is the whole pile of frames. A stack frame is one entry in it.
Say it at work
- In a meeting or chat
Which frame is this variable in?
- In an email or ticket
Walk up one frame to see the caller.
Keep exploring
More in Programming Fundamentals