Two Semispaces and a Compacting Sweep
Copying garbage collection (Cheney's algorithm) partitions the heap into two equal-sized semispaces: from-space and to-space. All live objects start in from-space. When memory is exhausted, the garbage collector scans from-space from the roots (global variables, stack frames), marks reachable objects, and copies them to to-space, compacting them into a contiguous region. The entire from-space is then reclaimed.
The beauty of copying GC is that compaction is free: objects are copied in order into to-space, eliminating fragmentation. Every surviving object gets a new address, so the garbage collector must update all references (a scan of the to-space after copying finishes the job).
Trade-offs and Usage
Copying GC wastes half the heap space (to-space is empty until needed). But the algorithm is simple, has excellent cache locality (to-space is compacted), and has predictable latency (proportional to live objects, not total heap size). Languages like Scheme, some Lisp implementations, and the Java HotSpot VM use copying collection for young-generation heaps where most objects die quickly.
The cost of updating all references can be high if references are scattered throughout the heap. Generational garbage collectors pair copying GC on the young generation (where allocation and death are frequent) with a more efficient algorithm on the old generation (where most objects are long-lived). This hybrid approach avoids the space waste of copying the entire heap.