Add gc-basics: Java garbage collection explained and measured on JDK 25, 27, 28 EA

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b44MquEzmd9QMkZCd7
This commit is contained in:
asmhatre
2026-11-24 06:46:39 +05:30
co-authored by Claude Sonnet 5.5
parent f7b6c1efca
commit 876ae1bb5c
36 changed files with 948 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
# Which collector does the JVM pick when you name none? (emulating a 1, 2 and 4 CPU machine with -XX:ActiveProcessorCount)
## JDK 25: OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
$ java -XX:ActiveProcessorCount=1 Which
collector MXBeans : Copy | MarkSweepCompact
$ java -XX:ActiveProcessorCount=2 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
$ java -XX:ActiveProcessorCount=4 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
## JDK 27: OpenJDK Runtime Environment Temurin-27.0.1.1+4 (build 27.0.1.1+4)
$ java -XX:ActiveProcessorCount=1 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
$ java -XX:ActiveProcessorCount=2 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
$ java -XX:ActiveProcessorCount=4 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
## JDK 28: OpenJDK Runtime Environment Temurin-28+25-202611191755 (build 28-beta+25-ea)
$ java -XX:ActiveProcessorCount=1 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
$ java -XX:ActiveProcessorCount=2 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
$ java -XX:ActiveProcessorCount=4 Which
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation