Because of the memory management mechanism of the operating system, each process will be allocated a virtual address space (corresponding to 32-bit systems, it is 4G virtual process address space). Some memory addresses in the virtual address space are mapped to actual physical memory. , when the memory required by the process is larger than the actual physical memory, some of its virtual memory addresses will be mapped to the disk. Due to the existence of this mechanism, the process seems to be able to use a larger memory than the actual physical memory. Memory space.
For your question, JVM requires 3G of memory space, but the actual machine only has 1G. Therefore, the operating system will store the temporarily unused memory in the JVM process to the disk (ie Swap space). When the JVM needs to use another part of the memory When, the data in the disk is written to the memory through memory swap. Therefore, if it happens frequentlyMemory Swap, the program must be very slow.
Because of the memory management mechanism of the operating system, each process will be allocated a virtual address space (corresponding to 32-bit systems, it is
4G
virtual process address space). Some memory addresses in the virtual address space are mapped to actual physical memory. , when the memory required by the process is larger than the actual physical memory, some of its virtual memory addresses will be mapped to the disk. Due to the existence of this mechanism, the process seems to be able to use a larger memory than the actual physical memory. Memory space.For your question, JVM requires 3G of memory space, but the actual machine only has 1G. Therefore, the operating system will store the temporarily unused memory in the JVM process to the disk (ie Swap space). When the JVM needs to use another part of the memory When, the data in the disk is written to the memory through memory swap. Therefore, if it happens frequently
Memory Swap
, the program must be very slow.There is also virtual memory available.
It won’t work if you reduce the virtual memory or disable it directly.