Concept Flow - Garbage collection basics
Program runs
Allocate memory
Use memory
Is memory reachable?
No→Mark for collection
|Yes
Continue program
Garbage collector runs
Free unreachable memory
Memory available for reuse
This flow shows how a program allocates and uses memory, then the garbage collector identifies unused memory and frees it for reuse.