jvm - 关于java -Xms参数的疑问
伊谢尔伦
伊谢尔伦 2017-04-18 10:21:06
0
2
469

通过java -X看到java -Xms的解释

-Xms<size> set initial Java heap size

但我测试发现,
虽然我的机器内存只有1G,但通过 java -Xms3G -Xmx3G appname可以成功启动应用,那么这个分配机制是怎么的呢?

就是指定了-Xms 3G,但机器内存只有1G的情况下,是怎样分配内存的?

注:

# free -m|grep Swap
Swap:            0          0          0
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
大家讲道理

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.

迷茫

There is also virtual memory available.
It won’t work if you reduce the virtual memory or disable it directly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!