What does it mean and how important to know about it for a C/C++ programmers?
Is it the same across the platforms, at least conceptually?
I understand it as a block of allocated memory used to store local variable by a function...
I want to know more
An Activation Record is a data structure that is activated/ created when a procedure/function is invoked, and it includes the following data about the function. Activation Record in 'C' language consist of. Actual Parameters. Number of Arguments. Return Address.
An activation record (AR) is a private block of memory associated with an invocation of a procedure. It is a runtime structure used to manage a procedure call. An AR is used to map a set of arguments, or parameters, from the caller's name space to the callee's name space.
– memory for each parameter (input) – memory for each local variable. – memory for the return value. This chunk of memory is referred to as an activation record. Thus, a recursive function that calls itself ¡ times must allocate ¡ activation records.
Compiler DesignAn activation tree is a tree structure that represents function calls made by a program during execution. When a function is called a new activation record is pushed to the stack and popped from the stack when the function returns.
An activation record is another name for Stack Frame. It's the data structure that composes a call stack. It is generally composed of:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With