How to force garbage collection in Java?

后端 未结 22 1864
离开以前
离开以前 2020-11-22 00:31

Is it possible to force garbage collection in Java, even if it is tricky to do? I know about System.gc(); and Runtime.gc(); but they only suggest t

22条回答
  •  我寻月下人不归
    2020-11-22 00:48

    To manually Request GC (not from System.gc()) :

    1. Go To : bin folder in JDK eg.-C:\Program Files\Java\jdk1.6.0_31\bin
    2. Open jconsole.exe
    3. Connect to the desired local Process.
    4. Go To memory tab and click perform GC.

提交回复
热议问题