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.
-
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– Marko Topolnik2013-08-25 11:06:45 +00:00Commented Aug 25, 2013 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-– chrylis -cautiouslyoptimistic-2013-08-25 11:07:01 +00:00Commented Aug 25, 2013 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– Marko Topolnik2013-08-25 11:22:46 +00:00Commented Aug 25, 2013 at 11:22
Add a comment
|