Java3.-Java中的垃圾回收

Java中垃圾回收有什么目的?什么时候进行垃圾回收?

垃圾回收的目的是识别并且丢弃应用不再使用的对象来释放和重用资源。

触发主GC(Garbage Collector,垃圾回收)的条件:

(1)当应用程序空闲时,即没有应用线程在运行时,GC会被调用。

(2)Java堆内存不足时,GC会被调用。

原地址

链接:https://www.nowcoder.com/questionTerminal/669b88c90a7545e6aa556beef815c43f
来源:牛客网

  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2015-2020 John Doe
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信