That is a very generalized question. Actually you get outofmemory error when jvm does not have enough memory on the heap for creating new objects. Generally the default heapsize can be altered by two VM arguments -Xms256m (for initial heap size) and -Xmx512m (for max. heap size) to allocate the heap size to be allocated to your java application. The arguments to the VM above depend upon the actual memory you have. The above optimization works assuming that you don't have any memory leaks in your application code. If you still find such problems i suggest that you use an appropriate java memory profiler to identify any memory leaks. I suggest that you have a look at the java performance forum also.
Joined: Dec 10, 2007
Actually I am trying to understand basics of this problem. When the user is getting "java.lang.outofmemoryerror" , does it mean there is not enough space on the server to create thread ?
How can I check, what existing heapsize is ?
Wheer do I execute -Xmx512m command ? On the command prompt on server ?
Originally posted by jignesh soni: Actually I am trying to understand basics of this problem. When the user is getting "java.lang.outofmemoryerror" , does it mean there is not enough space on the server to create thread ?
The JVM only has a limited amount of memory it can access; I believe it is 64MB by default. Once it reaches this limit it there is no more memory available for the JVM (even though the operating system does) and the error is thrown. The mentioned flags can change that limit for you.