stack-overflow

How to handle or avoid a stack overflow in C++

倖福魔咒の 提交于 2019-12-02 17:34:05
In C++ a stack overflow usually leads to an unrecoverable crash of the program. For programs that need to be really robust, this is an unacceptable behaviour, particularly because stack size is limited. A few questions about how to handle the problem. Is there a way to prevent stack overflow by a general technique. (A scalable, robust solution, that includes dealing with external libraries eating a lot of stack, etc.) Is there a way to handle stack overflows in case they occur? Preferably, the stack gets unwound until there's a handler to deal with that kinda issue. There are languages out

javascript unique random numbers

百般思念 提交于 2019-12-02 16:35:14
问题 experts I wish to generate unique random numbers between two numbers (from text box of web page). I am using array to store numbers. when user click button it gives first random number, store it in array, and when user clicks button again, it generate random number, compares it with array numbers, and if different, stores it and displays it. If maximum possible different numbers are show it, clears array and informs user. I have written code, but it gives error : stack overflow, or sometimes

How does one implement a “stackless” interpreted language?

不想你离开。 提交于 2019-12-02 16:22:45
I am making my own Lisp-like interpreted language, and I want to do tail call optimization. I want to free my interpreter from the C stack so I can manage my own jumps from function to function and my own stack magic to achieve TCO. (I really don't mean stackless per se, just the fact that calls don't add frames to the C stack. I would like to use a stack of my own that does not grow with tail calls). Like Stackless Python, and unlike Ruby or... standard Python I guess. But, as my language is a Lisp derivative, all evaluation of s-expressions is currently done recursively (because it's the

Stackoverflow Exception in a simple dialog

江枫思渺然 提交于 2019-12-02 15:54:00
问题 Hello i am getting an Stackoverflow Exception in this two dialog. Dialog A is being called from a main dialog class. Dialog A have a choice to go to Dialog A child and Dialog A child has a choice to go back to Dialog A . But it is getting a Stackoverflow Exception. When i remove one from the other: Example removing Dialog A child from Dialog A or removing Dialog A from Dialog A child , the exception error disappears. In short it throw a Stackoverflow Exception when both dialog can call each

Action Performed when Button Clicked n Times

你。 提交于 2019-12-02 14:53:27
问题 public void boss(final Boss boss) { forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { boss.setHp(boss.getHp() - 1); log("" + boss.getHp()); } }); if(boss.getHp() > 0){ boss(boss); } } So, in the above code, I am trying to have bossHp reduce by 1 every time forward is clicked. There is a stackoverflow error with the code. (It is just calling boss() in an infinite loop.) How can I have it keep reducing bossHp by 1 every time the user clicks forward, and then

Why is #include <string> preventing a stack overflow error here?

断了今生、忘了曾经 提交于 2019-12-02 14:20:06
This is my sample code: #include <iostream> #include <string> using namespace std; class MyClass { string figName; public: MyClass(const string& s) { figName = s; } const string& getName() const { return figName; } }; ostream& operator<<(ostream& ausgabe, const MyClass& f) { ausgabe << f.getName(); return ausgabe; } int main() { MyClass f1("Hello"); cout << f1; return 0; } If I comment out #include <string> I don't get any compiler error, I guess because it's kind of included through #include <iostream> . If I "right-click --> Go to Definition" in Microsoft VS they both point to the same line

HTTP Status 500 - Filter execution threw an exception - doFilter and invokeDelegate repeated

老子叫甜甜 提交于 2019-12-02 14:17:40
问题 I'm using Spring-MVC (4.2.5) and Spring-Security (4.1.3) to develop a web application. I begin to have problems when I tried to incorporate the latter in my mvc project. Currently, after several attempts, I get this error in my tomee server at localhost:8080/BetEx/ HTTP Status 500 - Filter execution threw an exception type Exception report message Filter execution threw an exception description The server encountered an internal error that prevented it from fulfilling this request. exception

Getting exception in thread “main” java.lang.StackOverflowError

喜欢而已 提交于 2019-12-02 14:11:53
问题 I am new to Java and OOPs and here is my issue. When I run the below code, I get the Exception in thread "main" java.lang.StackOverflowError. The problem is in the code were I create an object of JavaApplication1 .The problem is not occurring for class App2 . The code works fine if the object ja is created inside the run method. Can you explain me why? package javaapplication1; public class JavaApplication1 { int i, k, j; class App2 { int i = 23; int j = 12; } App2 a2 = new App2();

forrt1: severe (170): Program Exception - stack overflow

泪湿孤枕 提交于 2019-12-02 13:52:06
问题 and thanks ahead of time for any help! I have compiled a program (which I did not write) and it works just fine on Mac's but when I try to execute the program on Windows I get the following error message shortly after execution of the program began: forrt1: severe (170): Program Exception - stack overflow I am not an ifort or Fortran user, but trying to compile a program for work. I did an "ifort --version" and I am using Intel Visual Fortran Compiler XE with verion 12.0.0.104. I have been

Simple QuickSort Algorithm giving Stack Overflow Error?

安稳与你 提交于 2019-12-02 13:08:40
My friend has a small problem and I'm at the end of my knowledge. He wrote a Simple (he got it in school) QuickSort Algorithm And it produces a StackOverflow Error. I know it means it calls itself recursive too many times somewhere, but I can't get the logical Error - please help me! Here is the code (I'm leaving out some code as that is only to show it in 2 text areas): int array [] = new int [10]; ... public static void quicksort (int array[],int l,int r){ int i = l; int j = r; int mitte = array [(l+r)/2]; while (i<j) { while (array[i]<mitte) { i++; } // end of if while (mitte<array[i]) { j-