0

How is this possible?
or how does JVM allocates -xms memory?

Also, there seems to be no swap space

% free -h
             total       used       free     shared    buffers     cached
Mem:           14G       7.9G       6.8G       132K       1.1G       2.3G
-/+ buffers/cache:       4.5G        10G
Swap:           0B         0B       

but looks like there is local disk

% df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvdb             118G  9.3G  103G   9% /local
ealeon
  • 12,074
  • 24
  • 92
  • 173
  • 2
    It's the [memory overcommitment](https://en.wikipedia.org/wiki/Memory_overcommitment). OS allows to allocate more virtual memory than the amount of physical memory as long as the extra memory is not used. In Linux this is controlled with [vm.overcommit_memory](https://www.kernel.org/doc/Documentation/vm/overcommit-accounting) sysctl. – apangin Feb 06 '19 at 07:55
  • 2
    A virtual memory page becomes used (i.e. allocated in physical memory or swap) at the first write to it. Add `-XX:+AlwaysPreTouch` JVM option to explicitly touch all pages of Java Heap, and JVM will likely crash. – apangin Feb 06 '19 at 08:05
  • See also [this question](https://stackoverflow.com/questions/48982636/java-heap-xms-and-linux-free-memory-different). – apangin Feb 06 '19 at 08:06
  • @apangin my understanding is that you couldnt virtual memory w/o swap space and hence i've noted in the question that there is no swap space, no? – ealeon Feb 06 '19 at 20:53
  • No. That's the point of overcommitment - to satisfy allocation even if the requested amount of virtual memory not backed by physical storage or swap space. And that's the feature of OS; JVM does nothing special, it simply calls `mmap`. – apangin Feb 07 '19 at 21:45

0 Answers0