Garbage collection involves walking through a list of allocated objects (either all objects or objects in a particular generation) and determining which are reachable.

  1. How is this list maintained? Do runtimes for GC languages keep a giant list of all objects?

  2. Also, from what I understand, GC involves walking the call stack to look for object references - how does the algorithm distinguish between GC-able pointers and primitive data?

Edit
Report