Does GC release back memory to OS?

前端 未结 5 1082
被撕碎了的回忆
被撕碎了的回忆 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条回答
  •  無奈伤痛
    2020-11-22 09:21

    The JVM does release back memory under some circumstances, but (for performance reasons) this does not happen whenever some memory is garbage collected. It also depends on the JVM, OS, garbage collector etc. You can watch the memory consumption of your app with JConsole, VisualVM or another profiler.

    Also see this related bug report

提交回复
热议问题