When does garbage collection work in java?

I knew there were a lot of articles about java garbage collection, but after searching I don’t know exactly when the dose of garbage collection starts in a Java application (when the application restarts or while it is still running) . "

+4
source share
4 answers

Garbage Collector- the flow of the demon. Behind the application, the dameon thread runs. It is launched by the JVM. the thread stops when all non-dameon threads stop.

The JVM manages the garbage collector; he decides when to run the garbage collector. The JVM runs a garbage collector when it realizes that memory is running low. GC behavior can be customized by passing parameters to JVM.

java, , jvm.Check Java?

...

+4

. JVM.

? , , , .

, JVM, . , , .

String capitalizeAll(String s) {
    char[] chars = s.toCharArray();
    for(int i = 0; i < chars.length; i++)
        chars[i] -= 32;
    return new String(chars);
}

, char[] chars, , . JVM, , , GC , .

, , JVM , , . , , JVM .

+2

.

, GC , ( GC , ). JVM safepoint , " ", , GC .

, GC , Hotspot CMS. - , - , , GC. CMS - , .

Azul Zing - - . - , STW. , , GC .

, . , , , . GC System.gc() , .

0

. SCJP:

" JVM. JVM , . Java- JVM , , JVM . , JVM, , , , . , , Java- , JVM , . , , , JVM .

0

All Articles