stack-overflow

How to handle StackOverflowError in Java?

风流意气都作罢 提交于 2019-11-26 21:13:30
问题 How to handle StackOverflowError in Java ? 回答1: I'm not sure what you mean with "handle". You can certainly catch that error: public class Example { public static void endless() { endless(); } public static void main(String args[]) { try { endless(); } catch(StackOverflowError t) { // more general: catch(Error t) // anything: catch(Throwable t) System.out.println("Caught "+t); t.printStackTrace(); } System.out.println("After the error..."); } } but that is most likely a bad idea, unless you

How to overcome Stack Size issue with Visual Studio (running C codes with big array)

那年仲夏 提交于 2019-11-26 20:48:25
I am using Visual Studio 13 to compile c codes for the first time. The codes run perfectly O.K. with 2d arays of size 64*64 (there are a few arrays in my programme) but if I increase the array size to 128*128 it does not run (but compile correctly). Instead it gives a message ".exe has stopped working". My machine has 4GB ram and the same programme run with 128*128 array if I run the codes from linux. Let me provide some more details: I have run the same code from linux using Intel C Compiler (non-commercial version) in the same machine. But due to some problem I am now constrained to work

Chrome/jQuery Uncaught RangeError: Maximum call stack size exceeded

≡放荡痞女 提交于 2019-11-26 19:21:30
问题 I am getting the error "Uncaught RangeError: Maximum call stack size exceeded" on chrome. here is my jQuery function $('td').click(function () { if ($(this).context.id != null && $(this).context.id != '') { foo($('#docId').val(), $(this).attr('id')); } return false; }); Note that there are tens of thousands of cells in the page. However, I generally associate stack overflows with recursion and in this case as far as I can see there is none. Does creating a lambda like this automatically

Clojure: Simple factorial causes stack overflow

我的梦境 提交于 2019-11-26 19:15:22
问题 What am I doing wrong? Simple recursion a few thousand calls deep throws a StackOverflowError . If the limit of Clojure recursions is so low, how can I rely on it? (defn fact[x] (if (<= x 1) 1 (* x (fact (- x 1)) ))) user=> (fact 2) 2 user=> (fact 4) 24 user=> (fact 4000) java.lang.StackOverflowError (NO_SOURCE_FILE:0) 回答1: The stack size, I understand, depends on the JVM you are using as well as the platform. If you are using the Sun JVM, you can use the -Xss and -XThreadStackSize parameters

Why does .NET behave so poorly when StackOverflowException is thrown?

一笑奈何 提交于 2019-11-26 19:01:44
问题 I'm aware that StackOverflowExceptions in .NET can't be caught, take down their process, and have no stack trace. This is officially documented on MSDN. However, I'm wondering what the technical (or other) reasons are behind the behavior. All MSDN says is: In prior versions of the .NET Framework, your application could catch a StackOverflowException object (for example, to recover from unbounded recursion). However, that practice is currently discouraged because significant additional code is

java.lang.StackOverflowError when pressing FX ComboBox on Android

南楼画角 提交于 2019-11-26 18:40:01
问题 When using JavaFXPorts on Android (Android 4.1.1 on Asus Transformer Prime TF201 tablet), a java.lang.StackOverflowError is thrown when pressing on a ComboBox (see below the top stacks of the stacktrace). It happens in a ComboBox in my FX application and is also 100% reproducible with the ComboBox example that is in Ensemble. In other words: can't use JavaFX ComboBox. I'm aware of the Android stack size limit posted in many forums and there are various suggestions on what to do when it

Why is it possible to recover from a StackOverflowError?

馋奶兔 提交于 2019-11-26 17:59:49
问题 I'm surprised at how it is possible to continue execution even after a StackOverflowError has occurred in Java. I know that StackOverflowError is a sublass of the class Error. The class Error is decumented as "a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch." This sounds more like a recommendation than a rule, subtending that catching a Error like a StackOverflowError is in fact permitted and it's up to the programmer's

Increase stack size when compiling with mingw?

戏子无情 提交于 2019-11-26 17:05:26
问题 I'm writing a recursive flood-fill algorithm to find connected components in an image, my code compiles and runs well with MSVC 2008 compiler; but the mingw-compiled binary crashed at runtime. After I converted the algorithm to non-recursive with std::stack, everything goes well. But what if I must use recursive algorithm in some case, and mingw cannot handle it? How can I increased stack size of a binary, is there any compilation options? Thanks 回答1: Use gcc -Wl,--stack,N where N is stack

How does a “stack overflow” occur and how do you prevent it?

余生长醉 提交于 2019-11-26 17:05:01
How does a stack overflow occur and what are the best ways to make sure it doesn't happen, or ways to prevent one, particularly on web servers, but other examples would be interesting as well? Stack A stack, in this context, is the last in, first out buffer you place data while your program runs. Last in, first out (LIFO) means that the last thing you put in is always the first thing you get back out - if you push 2 items on the stack, 'A' and then 'B', then the first thing you pop off the stack will be 'B', and the next thing is 'A'. When you call a function in your code, the next instruction

Function parameters max number

时光毁灭记忆、已成空白 提交于 2019-11-26 17:03:08
问题 I did not find any limitation of count function parameters in the C99 standard and I guess it is only limited by stack size. However I've written a simple test program to demonstrate the behavior of a function with a large count of parameters. When its about 10k, I get the following error on gcc (gcc version 4.5.3 on Cygwin): /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../libcygwin.a(libcmain.o):(.text+0xa9): undefined reference to `_WinMain@16' I realize that such large count of parameters is