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) . "
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.
Garbage Collector
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.
JVM
java, , jvm.Check Java?
...
. 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 , .
char[] chars
, , JVM , , . , , JVM .
.
, GC , ( GC , ). JVM safepoint , " ", , GC .
, GC , Hotspot CMS. - , - , , GC. CMS - , .
Azul Zing - - . - , STW. , , GC .
, . , , , . GC System.gc() , .
. SCJP:
" JVM. JVM , . Java- JVM , , JVM . , JVM, , , , . , , Java- , JVM , . , , , JVM .