Blog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2025 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Java
Javahard

How does Java GC work at a high level (and why is it generational)?

Tags
#gc#jvm#memory
Back to categoryPractice quiz

Answer

The heap is typically split into young/old generations: most objects die young, so collecting the young gen is cheap and frequent (minor GC). Surviving objects are promoted; old gen collections are rarer and usually more expensive.

Related questions

Java
JIT compilation: what is it and why do Java apps “warm up”?
#java#jit#performance
Java
Generational garbage collection: why does the JVM split memory into young/old?
#java#gc#jvm
Java
ClassLoaders: what are they and why can they cause surprising ClassCastException?
#java#classloader#jvm
Java
What is the Java classpath and what is it used for?
#classpath#jvm#jar
Java
JDK vs JRE vs JVM - what is each?
#jvm#jre#jdk
Java
WeakReference — what is it and when is it useful?
#weakreference#weakhashmap#gc