Understanding Java Memory Settings
by, 02-18-2012 at 04:28 PM (1097 Views)
-Xmx & -Xms parameters set memory. Here discussion would be done regarding such parameters that why they are used to set memory.
JVM i.e. Java Virtual Machine is produced in system memory, when Java starts. Execution as well as complete process of Java program occurs in JVM. Java applications have 64MB memory, by default.
In JVM, Xms is minimum heap size. If high sized initial memory is set, this might help a lot. Like,
- GC would be made to work lesser, that is much more efficient.
- Initially, if memory size has been set higher then there would be no need to grow fast like memory size.
- JVMís overhead is saved so that to ask for enough more memory.
In JVM, maximum memory size is specified by using Xmx. When JVM is closed to full utilization of initial memory Xmx settings are being checked to known if more memory could be drawn out from system resources.
Allocation of memory is considered to be a very expensive operation in JVM. GC is used for reallocation of memory when JVM gets close to initial memory.