Delete unused variable's memory in java

前端 未结 8 655
不知归路
不知归路 2020-12-28 12:19

I know that Java have its own garbage collection, but sometimes I want to delete the garbage manually. Is there any way to do the work like that? And considering that I have

8条回答
  •  孤独总比滥情好
    2020-12-28 12:50

    You can assign null to variables, verify that there is no any references to these objects and call System.gc(), but is is only a suggestion for JVM to call a GC, but there is no guarantee. Garbage collection cal slows your application up to a freeze (stop-the-world GC).

提交回复
热议问题