Delete unused variable's memory in java

前端 未结 8 602
不知归路
不知归路 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:52

    You can call System.gc(); which might lead the garbage collector to cleanup. But sure this will affect the performance of your application. In general it doesn't make sense to try to "optimize" anything here.

提交回复
热议问题