When is the garbage collector used in java?

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

+1
source share
4 answers

The Java garbage collection algorithm, as I understand it, is quite complicated and not so simple. In addition, there is more to the GC than the algorithm that can be selected at the time the VM starts up with the argument passed to the JVM.

This is often the question about garbage collection: http://www.oracle.com/technetwork/java/faq-140837.html

Oracle "Tuning Garbage Collection 5.0 Java [tm]", , , : http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

+8

JVM java , , JVM-, . JVM, , , GC.

, JVM GC, . gc ( /), .

+2

Java, JVM .

, .

, , , . , .

- jvisualvm Sun 6 JDK. , , .

https://visualvm.dev.java.net/monitor_tab.html ( )

+1

. - .

, , . , .

Memory management is carried out in pools in accordance with the generation. When the pool of memory of the young generation is full, a small collection takes place. Surviving objects are moved to the memory pool. When the accumulated generation memory pool is full, a large collection occurs. The third generation is preserved, which is known as the permanent generation and may contain objects that define classes and methods.

0
source

All Articles