Difference between system.gc() and runtime.gc()

前端 未结 7 844
谎友^
谎友^ 2020-12-12 19:15

What is the difference between System.gc() and Runtime.gc()?

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

    System.gc():

    1: It is a class method(static method).

    2: Non-Native method.(Code which doesn't directly interacts with Hardware and System Resources).

    3: System.gc(), Internally calls Runtime.getRuntime().gc().

    Runtime.gc():

    1: Instance method.

    2: Native method(A programming language which directly interacts with Hardware and System Resources.).

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