While writing a program for a microcontroller in C language, we use?
I think what your seeing is a stack frame, or memory allocation for standard variables. I'll assume stack frame. When you call a function in assembly, it's not (usually) a 1 line thing. Normally, you save variables to memory/stack, put parameters where function will find them (again, stack or memory locations), save the program counter, and calls the function (just the program counter to the start of the function). Then the function finds the parameters, allocates local variables, does it's thing, sets up the return value (usually in a set register), deallocates the variables, and reloads the old program counter to return to where it left. Then the saved variables are reloaded, return value saved, and we're back to procedural execution. If that looks like alot to call a damn function, you are correct, it is, but that's assembly (loosely based on x86). What your are seeing is after the function is called, when it allocates, and then right before it returns, when it deallocates. That marks the start and end of the stack frame. It's not really managed, it's more the compiler is good enough to not have memory leeks (usually). It's done through OS calls mostly. Read up on your assembly (x86 or MIPS are easy to learn), you'll see how it works. Have fun :).