Does GC release back memory to OS?

前端 未结 5 1127
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 08:44

When the garbage collector runs and releases memory does this memory go back to the OS or is it being kept as part of the process. I was under the strong impression that the

5条回答
  •  猫巷女王i
    2020-11-22 09:21

    this article here explains how the GC work in Java 7. In a nutshell, there are many different garbage collectors available. Usually the memory is kept for the Java process and only some GCs release it to the system (upon request I think). But, the memory used by the Java process will not grow indefinitely, as there is an upper limit defined by the Xmx option (which is 256m usually, but I think it is OS/machine dependant).

提交回复
热议问题