Question
What is a callstack? callstack depth?
I'm using a profiler (shark on mac) and it give me a graphical representation of the code. but the graph is a callstack vs the number of samples. What is a callstack? what does it represent?
Thanks!
Answer
callstack
when a method call a another method the new method is put on top of a what called a call stack
when the top most method finish it's removed form the call stack
to a method in the lower level to finish it must first finish all the methods on top of it :)
the max number of methods in the stack is the depth.
Fellowing is a call stack
main thread (
e50):
00504527 +01f VCon32.exe ComCtrls TListItem.SetImage
00566257 +177 VCon32.exe DSoft....MainConsole 970 +19 TMainConsole.ProgressEvent
0047fe98 +0e4 VCon32.exe Graphics TBitmap.Assign
004ab658 +024 VCon32.exe Controls TControl.Perform
004aa30d +01d VCon32.exe Controls TControl.SetTextBuf
0050d561 +031 VCon32.exe VideoConvertL 843 +1 TCustomVideoConvertor.FFVCLProgress
004eebe8 +018 VCon32.exe FFmpegVCL TCustomFFmpegVCL.CallProgress
00474019 +0fd VCon32.exe Classes CheckSynchronize
004c961e +68a VCon32.exe Forms TApplication.WndProc
00475eac +014 VCon32.exe Classes StdWndProc
7e4196c2 +00a USER32.dll DispatchMessageA
004c9d70 +0fc VCon32.exe Forms TApplication.ProcessMessage
004c9daa +00a VCon32.exe Forms TApplication.HandleMessage
004ca09f +0b3 VCon32.exe Forms TApplication.Run
0056dfd6 +15e VCon32.exe VCon32 56 +31 initialization
this show what methods are running now. and is used in Debugging programs and CPU keep track of order they are called.
when program reach th max stack depth and call a another method it will raise a stack over flow Error and crash
in the stack given first method to run is initialization witch called TApplication.Run and .... and the last and method running at the time of that was taken was TListItem.SetImage
Hope this Helps
Kaushalya Damitha
Other Answer
When the program makes a call to another routing, it puts the return address (the next line of code) on the stack. When the called routine is finished it pops the return address off the stack so the program can resume at the line after the call.
Think of the stack as one of those plate stacks in a restaurant. If you put a plate on it, the next one taken off will be the one you put on.

Ask

