Call Stack
Definition - What does
Call Stack
mean?
A call stack, in C#, is the list of names of methods called at run time from the beginning of a program untilthe execution of thecurrent statement.
A call stack is mainly intended to keep track of the point to which each active subroutine should return control when it finishes executing.Call stack acts as a tool to debug an application when the method to be traced can be called in more than one context. This forms a better alternative than adding tracing code to all methods, which call the given method. Whenever an exception is thrown anywhere in the user code, the Common Language Runtime (CLR) will unwind the call stack and search for the catch block to determinethe specific exception type . If there is no appropriate handler, CLRwill terminate the application.Call stack, therefore, is used to tell theexecution pointer where to go next.
Techopedia explains
Call Stack
Call stack is organized as "stack," a data structure in memory for storing items in a last-in-first-out manner, so that the caller of the subroutine pushes the return address onto the stack and the called subroutine, after finishing, pops the return address off the call stack to transfer control to that address.
In C#, any application begins with a "main" method, which in turn calls other methods. On every call to a method, the method is added to the top of the stack and is removed from the stack on its return to the caller. Also, the scope of a variable declared in a block is determined from the time its value is pushed onto the stack (as part of call stack) until the execution leaves the block when the variable and the call stack are popped off the stack. Thus, the stack maintains both local variables (value types) and the call stack (stack frames), the size of which indicates the complexity of a program.
This definition was written in the context of C#.
Home
Dictionary
Tags
Development
Related Terms
Method
Common Language Runtime (CLR)
Try/Catch Block
Related Videos
Related Links
Related White Papers
Other Resources
Related Tags
Categories:
.NET
C Sharp
Development
Tweet
Tweet
Popular White Papers
Techopedia Newsletter Sign-Up
Get Techopedia delivered to your inbox!
Term of the Day:
Get a new Techie Term sent to you every business day
Best of Techopedia:
We"ll bring you the best Techie articles each month.
Sign-In
Join Techopedia
Follow Us
Follow Techopedia on Facebook
Follow Techopedia on LinkedIn
Follow Techopedia on Twitter
Add Techopedia on Google Plus
Get Techopedia on RSS
Home
Dictionary
Articles
Tutorials
Newsletters
Development
Networks
Wireless
Support
Linux
Enterprise
Enterprise Apps
Security
CRM
IT Business
IT Careers
IT Management
Trends
Cloud Computing
Mobile computing
Personal Tech
Gaming
Internet
Search Engines
Social Media
World Wide Web
All Topics
Hacking
Online Marketing
Buzzwords and Jargon
Viruses
Operating Systems
Legal
People