When to Garbage Collect

前端 未结 8 1232
逝去的感伤
逝去的感伤 2020-12-11 04:24

I have a piece of code that load a very big image in memory. So it seemed like a reasonable thing to call

System.gc();

before loading the

8条回答
  •  鱼传尺愫
    2020-12-11 04:43

    Typically the GC is smarter than you, so it's better to let it run whenever the runtime decides. If the runtime needs memory, it'll run the GC itself

提交回复
热议问题