2012年11月26日 星期一

How to set Java memory size

1.  What is the heap function in java ?
Java heap is the heap size allocated to JVM applications which takes care of the new objects being created. If the objects being created exceed the heap size, it will throw an error saying memoryOutof Boun.


2. Problem:
How to set the java memory? to avoid the OutOfMemoryException.
and how much is fit?


3. Solution:
A.How to set java memory
Memory usage = Stack Size + Heap Size + Code Size
  
-Xmsinitial java heap size
-Xmxmaximum java heap size


-Xssset thread stack size




B. How much is fit on your application?
IBM technical report say about head size

Size your Java heap so that your application runs with a minimum heap usage of 40%, and a maximum heap usage of 70%.


Reference:
IBM heap size advice
How to set java memory and debug
Java Memory Talk
what_is_java_heap_size

沒有留言:

張貼留言