Java VM - does the freed memory return to the OS?

前端 未结 2 1750
刺人心
刺人心 2020-12-12 02:02

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?

2条回答
  •  渐次进展
    2020-12-12 02:32

    That depends on the JVM implementation and isn't specified in the specification.

    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).

提交回复
热议问题