When is garbage collector used in java?

后端 未结 4 1715
一个人的身影
一个人的身影 2021-01-23 15:10

As far as I know GC is used only when JVM needs more memory, but I\'m not sure about it. So, please, someone suggest an answer to this question.

4条回答
  •  深忆病人
    2021-01-23 15:28

    The garbage collection algorithm of Java is as I understand, pretty complex and not as straightforward. Also, there is more than algorithm available for GC, which can be chosen at VM launchtime with an argument passed to the JVM.

    There's a FAQ about garbage collection here: http://www.oracle.com/technetwork/java/faq-140837.html

    Oracle has also published an article "Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine" which contains deep insights into garbage collection, and will probably help you understand the matter better: http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

提交回复
热议问题