#846 – A Call Stack Keeps Track of Methods that Have Been Called

When your application is running, Windows uses a stack data type to manage its call stack.  A call stack is essentially just a record of the currently active methods.  At the top of the stack is the current method that is executing.  Below this method in the stack is the method that called the current method.  At the bottom of the stack is the first method that began executing when your application started.

For example, if you have a Main method that calls method Dog.BarkYourAge and this method in turn calls a method named DogUtil.GenerateBark, the call stack will appear as follows during executing of GenerateBark.  (For simplicity, we’re ignoring the .NET Framework methods that are called before invoking Main).

846-001

When a method is called, it is pushed onto the stack.  When it returns to its calling method, it is popped off of the stack.

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: