On 17 May 2010 13:18, Mercy <techme...@gmail.com> wrote: > Hi, > > Please take a look at this: > http://java.sun.com/javase/6/docs/technotes/guides/vm/gc-ergonomics.html > > *maximum heap size:* > > Smaller of 1/4th of the physical memory or 1GB. Before J2SE 5.0, the > default maximum heap size was 64MB. You can override this default > using the |-Xmx| command-line option. > > > It does not mean just only use 1/4th, it will increase overload to system > if more than 1/4th of the physical memory. >
That page describes the default settings of the Java memory system: it will use 1/4 of the physical memory of the machine. > If you had more practical setting , please tell me. > > It depends on your application and your physical architecture. I've seen 16 Gbyte Windows machines with 12 Gbyte Java heaps - 4 Gbytes was enough for the operating system, other processes, the disk cache, and Windows' crazy insistence on keeping 10% "available". I've also seen 8 Gbyte machines with 64M devoted to Java, as the big memory hog was a database server on the same machine. Monitor your current settings to see what performance problems you are seeing. If your JVM is not competing with anything else for resources, try increasing heap memory to 50% or even 75% of RAM... but, each time you change the setting, monitor the machine to see what performance problems you have resolved and what new problems you have introduced. "If you don't measure it, you can't fix it." - Peter