Garbage Collection
Reclaiming what can no longer be reached: mark and sweep, compaction, the generational split, and barriers that let collection run concurrently. Pauses show up as user-visible latency.
part ofComputer science fundamentalsoverview, primer and where to startread it →on this pageshowhide
explore
- Liveness and Roots5 questions
- Mark-Sweep and Copying4 questions
- Young and Old Generations5 questions
- Tri-Colour Invariant4 questions
- Incremental and Concurrent Tracing4 questions
- Pause, Throughput, Footprint6 questions
- Weak References and Finalizers5 questions
- AI & Data Scientistrole
- Android Developerrole
- Backend Developerrole
- Blockchain Developerrole
- Computer Scienceskill
- Data Analystrole
- Data Engineerrole
- Forward Deployed Engineerrole
- Full Stack Developerrole
- Game Developerrole
- Java Backend Developerrole
- JavaScriptskill
- Kotlin Backend Developerrole
- Machine Learning Engineerrole
- Server-Side Game Developerrole
- Software Architectrole
- iOS Developerrole
questions
page 2 of 2A collector cannot tell a reference from an integer in a thread's stack slot — what does guessing cost?
basics
~20 sIt must treat every stack word that looks like a heap address as a reference, so it retains objects nothing really points to along with everything they reach — and it cannot safely rewrite such a word to relocate the object.
When a copying or sliding-compaction collector relocates a live object, where is its new address recorded so references can be rewritten?
basics
~20 sAn evacuating collector writes a forwarding address over the abandoned original, so any reference still pointing at the old location finds the redirect. A sliding collector cannot overwrite an object it has not moved yet, so it computes new addresses into a side word or table in a separate pass first.
What does a post-mortem reference give a program that a cleanup hook attached to the object itself cannot?
basics
~10 sA post-mortem reference never hands the object back, so cleanup cannot resurrect it, and the notification arrives on a queue the program drains on its own thread and schedule, with ordinary error handling.
showing 31–33 of 33