Java Stack Overflow Error - How to Increase the Stack Size in Eclipse

Java stack overflow error - how to increase the stack size in Eclipse?

Open the Run Configuration for your application (Run/Run Configurations..., then look for the applications entry in 'Java application').

The arguments tab has a text box Vm arguments, enter -Xss1m (or a bigger parameter for the maximum stack size). The default value is 512 kByte (SUN JDK 1.5 - don't know if it varies between vendors and versions).

How to increase stack size to allow more recursion?

Your error is indeed a StackOverflow caused by too much recursion, but Processing covers that up with the strange error you're seeing. Documentation on that bug is here.

You can increase the Java stack size to increase the limit of recursive calls. Info can be found here, but the gist is that you have to pass the -Xss setting into Java at runtime.

However, that setting requires that you run your sketch as a Java application. This is possible, but it involves exporting your sketch as a jar, then running the jar via the command prompt, or switching to eclipse. That's a lot more work than simply hitting the run button in Processing- and any users you send your jar would have to do the same.

Instead, you should probably refactor your algorithm to eliminate the excessive recursion.

How to increase the Java stack size?

Hmm... it works for me and with far less than 999MB of stack:

> java -Xss4m Test
0

(Windows JDK 7, build 17.0-b05 client VM, and Linux JDK 6 - same version information as you posted)

Increase stack size in ECLiPSe/prolog/fd

First, from error message text I'm assuming that you mean ECLiPSe constraint logic programming system, not Eclipse IDE.

Second, how do you start ECLiPSe? How do you load your code into ECLiPSe?

Try this (you said you are on Windows):

  1. Open command line from the folder where your ECLiPSe source file (say, 'myprogram.ecl') exists. For instructions look at this page: http://www.techsupportalert.com/content/how-open-windows-command-prompt-any-folder.htm
  2. In the command line put eclipse -g 512000 and press ENTER.
  3. Load your program using [myprogram]. (put name of your ECLiPSe source file instead of 'myprogram').
  4. Execute queries as usual.

But I suspect that your program just runs forever and eats all memory, so all this probably won't help in the end.

EDIT. Updated instructions for TkECLiPSe:

  1. In TkECLiPSe in menu choose Tools -> TkECLiPSe Preference Editor.
  2. In preference window find option "Global/trail stack size (in megabytes)" and set it to 512.
  3. Save preferences and close TkECLiPSe.
  4. Next time you run TkECLiPSe stack size will be set to 512 Mb.


Related Topics



Leave a reply



Submit