Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Can we increase the stack size for JVM ?

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can we increase the stack size for JVM ?

    Hello,

    I am using a recursive function in my standalone java application which causes the stack over flow. So, I have increased the stack size to 2048k.

    Is that fine to increase the stack size? If not can any one suggest me how to over the issue.

    Thanks in advance,
    Prasanna


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Can we increase the stack size for JVM ?

    Post your code? It may be that there's something wrong with your recursive function.

  3. #3
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Can we increase the stack size for JVM ?

    If you are getting a StackOverflowError your code is probably doing something wrong and most likely calling it self over and over again without breaking out of the pattern. This will require a change to the code not increase the JVM heap size.

    However if you are receiving an OutOfMemoryError its because your program is trying to allocate more memory than the JVM has been given so a common solution to that problem is to increase the amount of heap size for the JVM.

    // Json

  4. #4
    Junior Member
    Join Date
    Jul 2009
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Can we increase the stack size for JVM ?

    I think its in the recursive loop and never coming out of it .

  5. #5
    Junior Member
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can we increase the stack size for JVM ?

    Thank you for all the suggestions. My code is very huge to post. I will look into the recursive function once again and try to find out the loop hole.

    Thanks you once again,
    Prasanna

Similar Threads

  1. How to Change JTextArea font, font size and color
    By Flash in forum Java Swing Tutorials
    Replies: 7
    Last Post: January 14th, 2012, 10:47 PM
  2. How to set the Listbox size.
    By jacinto in forum AWT / Java Swing
    Replies: 4
    Last Post: June 22nd, 2009, 07:39 AM
  3. How to Get the size of a file in bytes
    By JavaPF in forum File Input/Output Tutorials
    Replies: 1
    Last Post: June 8th, 2009, 10:19 AM
  4. Replies: 0
    Last Post: October 14th, 2008, 06:40 PM