Results 1 to 4 of 4
  1. #1
    Daedalus is offline Member
    Join Date
    Sep 2008
    Posts
    14
    Rep Power
    0

    Smile increase stack size in eclipse for highly recursive method.

    I'm running an algorithm which is highly recursive and I keep getting the

    Exception in thread "main" java.lang.StackOverflowError

    The code is correct, it has a return clause to break out, it is NOT recursing forever, it works perfectly if I call it via a loop.

    I need to tell eclipse to increase the Stack size. I think you would normally do this via a command line parameter but I'm not running it from the cmd line i'm running it through eclipse. I can not find any option in the eclipse compile preferences for increasing the java stack size.

    Does anybody know how to do this?

    Thanks in advance

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    How far does it go down before you run out of memory?

  3. #3
    Daedalus is offline Member
    Join Date
    Sep 2008
    Posts
    14
    Rep Power
    0

    Default

    The number of times it recurses depends on the size of the file the method is run on.

    It will work fine on small files when the number of recursions are low but fail when they go high. My method recursed on a large file 3197 times before the error was thrown.


    In the method I am creating 2 local ints each time. Thats all. I even set the ints to class variables insted of local method variables but it makes no difference. The rest of the time I am just referencing private fields of the class. The method does not generate any new data it just deletes some text in a String of a private field in the class.

    If I could just increase the stack in eclipse the problem would be solved but I can't find out where to do it.
    Last edited by Daedalus; 09-27-2008 at 12:59 AM.

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    3197 is way TOO many recursions. You need to redesign your logic to use a loop.

Similar Threads

  1. How to set a stack size. -Xss doesn't work
    By protonus in forum New To Java
    Replies: 4
    Last Post: 06-27-2008, 06:59 PM
  2. exercise of recursive method
    By amexudo in forum New To Java
    Replies: 2
    Last Post: 03-09-2008, 05:55 PM
  3. Replies: 1
    Last Post: 02-16-2008, 09:10 PM
  4. gridbaglayout: increase/decrease size of components.
    By newtojava7 in forum New To Java
    Replies: 2
    Last Post: 01-28-2008, 07:22 AM
  5. Recursive Method
    By bluegreen7hi in forum New To Java
    Replies: 5
    Last Post: 11-29-2007, 04:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •