Java VM - 释放的内存是否返回到操作系统?
在 Java 运行时,如果我的应用程序释放内存,运行时是否会将内存释放回操作系统?还是回到我的流程?
In the Java runtime, if my application frees memory, does the runtime release the memory back to the OS? Or just back to my process?
推荐答案
这取决于JVM实现,规范中没有指定.
That depends on the JVM implementation and isn't specified in the specification.
Sun JVM 将保留它作为第一步.一旦分配的内存的某个(可配置)百分比未使用,它会将其中的一部分返回给操作系统(该行为受 MinHeapFreeRatio
和 MaxHeapFreeRatio
设置).
The Sun JVM will hold onto it as a first step. Once a certain (configurable) percentage of allocated memory is unused, it will return some of it to the OS (the behavior is influenced by the MinHeapFreeRatio
and MaxHeapFreeRatio
settings).
相关文章