callstack

How does Smalltalk manipulate call stack frames (thisContext)?

若如初见. 提交于 2019-12-04 07:07:29
The Smalltalk object thisContext look strange and marvelous. I can't understand what it is and how it works. And even how it enables continuations. For C's call-stack, I can easily imagine how is it implemented and working. But for this... I can't. Please help me to understand it. I think it is not an easy question. The stack is reified in the image with instances of MethodContext. A MethodContext can have a sender, which is another MethodContext. That one can have another one...generating a whole stack. MethodContext are instantiated by the VM while executing CompiledMethod (which are also

Does Go have an “infinite call stack” equivalent?

淺唱寂寞╮ 提交于 2019-12-04 03:56:44
问题 I'm a newbie to Go, coming from Node.JS. In Node, if I run this: function run(tick = 0) { if (tick < 1000000) { return run(tick + 1); } return 0; } console.log(run()); The program will crash because the maximum call stack size was exceeded. If I do this in Go: package main import "fmt" func run(tick int) (int) { if (tick < 1000000) { return run(tick + 1) } return 0 } func main() { fmt.Println(run(0)) } This will run and print 0 to stdout. My questions are: Is there a maximum number of calls

Does the JS callstack always have at least one frame?

扶醉桌前 提交于 2019-12-04 03:43:18
问题 I've recently seen a presentation on the JS event loop which is, frankly, brilliant, but I have a lingering question now about the JS call stack. If you think about the global execution context as, say, main(), is main() never resolved? My reasoning here is that, if it were, then the JS program would be complete, and no callbacks would happen. --edit My primary interest here is how the call stack is represented, in relation to the callback queue. If the event loop is said to wait until the

Computing method call stack size for checking StackOverflowException

安稳与你 提交于 2019-12-04 02:24:08
Today morning I answered a question which is related to StackoverflowException . The person has asked when Stackoverflow exception occurs See this link Simplest ways to cause stack overflow in C#, C++ and Java So my question is that is there any method by which we can compute the method call stacks size dynamically in our program and then applying a check before calling a method which checks whether method call stack has space to accommodate it or not to prevent StackOverflowException. As I am a java person I am looking for java but also looking for explanation related to the concept without

Programatic access to call stack in .net

南笙酒味 提交于 2019-12-04 00:26:33
问题 How can I get programmatic access to the call stack? 回答1: Try System.Diagnostics.StackTrace. 回答2: You can use the StackTrace and StrackFrame classes in System.Diagnostics . 回答3: The right way is to use the StackTrace and StackFrame classes. Throwing an exception just to get the stack trace is completely misusing exceptions. 来源: https://stackoverflow.com/questions/13434/programatic-access-to-call-stack-in-net

Why is there a limit on the stack size? [duplicate]

不问归期 提交于 2019-12-03 20:05:01
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: What and where are the stack and heap My installation of Ubuntu has a default stack size limit of 8 MB. But I am curious as to why we need to restrict a user program's stack size. The same program can use all of its 4 GB (for a 32 bit program) addressable space via malloc/mmap etc. So why do we need a stack size limit? Why can't the stack grow till it almost meets the heap? 回答1: In fact the stack does grow more

How do I debug a difficult-to-reproduce crash with no useful call stack?

怎甘沉沦 提交于 2019-12-03 19:04:51
问题 I am encountering an odd crash in our software and I'm having a lot of trouble debugging it, and so I am seeking SO's advice on how to tackle it. The crash is an access violation reading a NULL pointer: First chance exception at $00CF0041. Exception class $C0000005 with message 'access violation at 0x00cf0041: read of address 0x00000000'. It only happens 'sometimes' - I haven't managed to figure out any rhyme or reason, yet, for when - and only in the main thread. When it occurs, the call

confusion about function call stack

限于喜欢 提交于 2019-12-03 17:25:03
问题 According to Wiki: the caller pushes the return address onto the stack, and the called subroutine, when it finishes, pops the return address off the call stack and transfers control to that address. Pic from Wiki: I don't quite understand this. Say I have a C program as follows: #include <stdio.h> int foo(int x) { return x+1; } void spam() { int a = 1; //local variable int b = foo(a); //subroutine called int c = b; //local variable } int main() { spam(); return 0; } And I think the call stack

How can I navigate the call stack in Visual Studio using just the keyboard?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 16:30:00
问题 My current solution is to hit Alt D , W , C , which navigates via the menus to the call stack, and then I can use the arrows to navigate. But once I press Enter on a particular frame, I have to repeat again. Is there a more fluid way to navigate the call stack with just my keyboard? ReSharper oriented answers are OK for me if you have one! 回答1: I use the VS2010 default keyboard mapping scheme and by pressing Ctrl + Alt + C brings up the call stack window in which I can use the arrow keys to

Call Stack at Runtime

妖精的绣舞 提交于 2019-12-03 16:03:14
I want to access the call stack at runtime in a Native C++ application. I am not using the IDE. How do I display the call stack? Update: I have a function which is called from many points all over the application. It crashes on rare occasions. I was looking for a way to get name of the caller and log it. Mark I believe that this page has the answer you are looking for. You said Visual C so I assume you mean windows. Will Dean Have a look at StackWalk64 . If you're used to doing this on .NET, then you're in for a nasty surprise. You should consider setting your unhandled exception filter and