What is activation record in the context of C and C++?

An activation record is another name for Stack Frame. It’s the data structure that composes a call stack. It is generally composed of:

  • Locals to the callee
  • Return address to the caller
  • Parameters of the callee
  • The previous stack pointer (SP) value

The Call Stack is thus composed of any number of activation records that get added to the stack as new subroutines are added, and removed from the stack (usually) as they return.

The actual structure and order of elements is platform and even implementation defined.

For C/C++ programmers, general knowledge of this structure is useful to understand certain implementation features like Calling Conventions and even why do buffer overflows allow 3rd party malicious code to be ran.

A more intimate knowledge will further the concepts above and also allow a programmer to debug their application and read memory dumps even in the absence of a debugger or debugging symbols.

More generally though, a C/C++ programmer can go by a large portion of their hobbyist programming career without even giving the call stack a moments thought.

Leave a Comment