I am running 6 java processes.I have set -Xms and -Xmx parameter to 1 GB for each process.So total heap allocation is 6 GB. I have 8 GB physical memory.So after starting these 6 processes ,"free" command should show 6 GB as used and 2 GB left but its not the case. Instead "free" shows only 1 GB is used and 7 GB is free. I am kind of confused as my understanding of -Xms(A MB) is that A MBs of memory is allocated to JVM by OS whereas -Xmx (B MBs) means JVM could expand up to B MBs. In my case both A and B are same. Please help here.
Asked
Active
Viewed 5,221 times
0
-
Physical memory is quite indirectly linked to virtual memory. Until there is any allocation on the heap, it doesn't occupy physical memory (the memory pages are not committed). – Marko Topolnik Aug 25 '13 at 11:06
-
It's not quite a duplicate. The docs don't clearly specify, and I'm not about to dive into the JVM source, but it may be that the JVM doesn't initially allocate the entire initial heap from the OS. – chrylis -cautiouslyoptimistic- Aug 25 '13 at 11:07
-
@chrylis The java process requests Xms memory for itself, but that doesn't at all mean that this much physical RAM is actually occupied. It's all virtual memory. – Marko Topolnik Aug 25 '13 at 11:22
1 Answers
0
If you use Linux, it might be because memory is not physically allocated to a process until the process write to the memory, even if the process have allocated the memory.

MTilsted
- 5,425
- 9
- 44
- 76