开发者

What is the difference between Call Stack and Stack Trace?

开发者 https://www.devze.com 2023-04-06 15:27 出处:网络
What开发者_高级运维 is the difference between the terms \"Call Stack\" and \"Stack Trace\" ?A call stack is typically \"the current stack of operations\" - i.e. while it\'s running.

What开发者_高级运维 is the difference between the terms "Call Stack" and "Stack Trace" ?


A call stack is typically "the current stack of operations" - i.e. while it's running.

A stack trace is typically a copy of the call stack which is logged at some sort of failure, e.g. an exception.

In other words, while you're debugging you will look at the current call stack - but when you look at logs, you'll get a stack trace. At least, that's my interpretation of the terms :)


I think Wikipedia does a fairly good job at distinguishing between them:

a call stack is a stack data structure that stores information about the active subroutines of a computer program

A stack trace is a report of the active stack frames at a certain point in time during the execution of a program.

In other words, the call stack is the actual data structure in memory, while the stack trace is a snapshot of said data structure.


Call stack is a data structure storing information about active subroutines in a running program. Stack trace is a representation of the call stack.


Call Stack is the raw executed code you see in the file. Stack Trace is the code that you see in the console. Simple as such.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号