Java garbage collection

前端 未结 7 2148
生来不讨喜
生来不讨喜 2020-12-05 09:44

Java automatically calls garbage collector, then why we need manual calls for garbage collection? When should use System.gc()

相关标签:
7条回答
  • 2020-12-05 10:19

    There is no need to call System.gc() or Runtime.getRuntime().gc(). The JVM internally controls garbage collection if it finds that it is running out of memory.

    0 讨论(0)
提交回复
热议问题