In Android, Should not be use System.gc()?

前端 未结 1 1219
再見小時候
再見小時候 2021-01-21 10:12

I wonder should not be use System.gc() in android.

I searched the developer document:

Result:

public static void gc ()<

相关标签:
1条回答
  • 2021-01-21 11:11

    Invoking System.gc() is not a guarantee of garbage collection actually being performed. It's more of a hint than anything else.

    In Java programming in general it has been regarded as very bad practice to use this method call because using it implies some level of expectation that garbage collection then happens. In truth, when garbage collection occurs depends on many things and is best left to the container and run-time tuning (if required).

    I'd say don't use System.gc() in Android for all the same reasons.

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