gc
7 tutorials tagged “gc”.
- Garbage Collection in JavaGarbage collection automatically frees memory of objects the program can no longer reach. Learn what it does, why Java uses it, its costs, and how to watch it.
- Garbage Collectors in JavaCompare the JVM's garbage collectors: Serial, Parallel, G1, ZGC and Shenandoah. Learn how each works, their pauses and throughput, and how to choose one.
- How Garbage Collection WorksLearn how the JVM finds live objects from GC roots, marks and sweeps or copies them, and why heaps are split into young and old generations.
- Object Lifecycle and ReachabilityAn object is created, used while reachable, becomes unreachable, and is then collected. Learn the stages and how objects become unreachable.
- Reading GC Logs in JavaTurn on GC logging with -Xlog:gc and read each line: the GC type, cause, heap before and after, and pause time. Learn the detailed gc* log and what to look for.
- Strong, Weak, Soft and Phantom ReferencesJava has four reference strengths. Learn how strong, soft, weak and phantom references affect garbage collection, with examples, ReferenceQueue and Cleaner.
- Safepoints and Stop-The-World PausesA safepoint is a moment when all Java threads stop so the JVM can do work such as GC. Learn why pauses happen, how to log them, and what makes them long.