Ctrl K
Java · Junior · Theory

What is the garbage collector in Java, and how does it figure out which objects can be removed?

~4 min by voice

How to approach it

This checks whether the candidate understands that Java's GC works through reachability from GC roots, not reference counting, and knows the basic practical consequences: generations, stop-the-world pauses, the possibility of memory leaks.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsA service running on G1 periodically has pauses of one to two seconds, and it's hurting latency. What would you do, and when is it worth looking at a different garbage collector? Mid-levelYou have a Java service with a 30 GB heap, and the business is complaining about long pauses. How would you choose and tune the garbage collector? SeniorTell me how memory is organized in the JVM: what's the difference between the stack and the heap, and what's stored where? JuniorIn production, a service crashes with an OutOfMemoryError every couple of days. How would you go about finding the cause? Mid-levelHow does memory management work in Python? How are objects that are no longer needed removed? Junior

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min