Home arrow static arrow Java Programming [Archive] - stack-heap size question
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - stack-heap size question
This topic has 2 replies on 1 page.

Posts:187
Registered: 12/15/01
stack-heap size question  
Jul 19, 2004 3:53 PM



 
hi,

my application uses quite big hashmaps and arraylist. now and then the application crashes because of a stack overflow. i wonder if the collections are using too much heap memory so there's noting left for the stack. does the jvm take care of memory protection in that case so that there's always enough stack memory left? i read that the class files got an entry which determines the needed size of stack memory. so i'm curious because this would mean i would rather run out of heap memory than runnin out of stack memory. i also read that the StackOverflowError is a jvm exception thrown when an application recurses too deeply. but i can't spot any recursion in my code (i also checked if i add the a collection to itself what obviously would lead into such an error). what's the next thing to check in such a case? any ideas?
thanx,
mischa
 

Posts:1,495
Registered: 6/16/03
Re: stack-heap size question  
Jul 19, 2004 7:54 PM (reply 1 of 2)



 
No, the heap doesn't affect stak size. Each thread reserves its own area of memory for its stack. You can set the size of the stack for each thread with the -Xss JVM option. I believ you should trace the execution of of your program with a debugger and watch the size of your stack to see where it blows up.

Good luck.
 

Posts:18,384
Registered: 21.03.00
Re: stack-heap size question  
Jul 19, 2004 11:22 PM (reply 2 of 2)



 
Hi,

The stack trace might give you some information about where the problem is.

/Kaj
 
This topic has 2 replies on 1 page.