Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2008, 01:07 AM
Member
 
Join Date: Jun 2008
Posts: 3
protonus is on a distinguished road
How to set a stack size. -Xss doesn't work
Hi,
Simple program:

public class Stack {

static int a;

static void f(){
a++;
f();
}

public static void main(String[] args){
a=0;
try{f();}
catch(StackOverflowError e)
{System.err.print(e.getClass() + " a= " + a);}
}
}


always throws StackOverflow error for the same value of a.
regardless I run the program as java -Xss1k Stack or java -Xss1024K Stack

My understanding is the larger stack the longer the program should run.

What I am missing?

Thank you for your help

Last edited by protonus : 06-27-2008 at 01:12 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-27-2008, 01:56 AM
pao pao is offline
Member
 
Join Date: Jun 2008
Posts: 41
pao is on a distinguished road
Try it like this: -Xms1024 -Xmx2048

Those options set the initial memory allocation and the maximum memory allocation, read the java documentation to see examples.

java - the Java application launcher
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-27-2008, 02:29 AM
Member
 
Join Date: Jun 2008
Posts: 3
protonus is on a distinguished road
Hi,
Xms and Xmx set a heap size not a stack size.
I tested them on jre1.5 and jre1.6 - no impact on my program behaviour.

I just noticed that -Xss doesn't work on Java5 only. It works on Java6.

So it looks like a bug in jre 1.5.

Thank for your help.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-27-2008, 12:30 PM
pao pao is offline
Member
 
Join Date: Jun 2008
Posts: 41
pao is on a distinguished road
Sorry about that, I didnt even know you could set the available stack memory, I only ever set the heap size. In fact thats the first time I have even encountered xss. Apologies!
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-27-2008, 08:59 PM
Member
 
Join Date: Jun 2008
Posts: 3
protonus is on a distinguished road
Me too. I also have never used xss before.
There is nothing to apologize for.
You pointed me on Xms i Wmx swichtes I also never used before
so I learned something new too.
Thank's again.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a stack from a LinkedList Java Tip java.lang 0 04-17-2008 12:28 AM
Stack not popping bugger New To Java 2 01-28-2008 06:59 PM
Stack Trace Java Tip Java Tips 0 12-10-2007 07:29 PM
Help with heap and stack coco Advanced Java 1 08-06-2007 04:21 PM
Creating a stack with data ai_2007 Advanced Java 2 07-02-2007 05:28 PM


All times are GMT +3. The time now is 02:55 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org