markcompact
Mark-compact is a family of garbage collection strategies that combine marking and compaction to reclaim memory and reduce fragmentation. In a mark-compact collector, live objects are first identified by traversing the object graph from root references and marking reachable objects. After marking, the collector compacts memory by relocating these live objects to one end of the heap, removing gaps left by dead objects and updating all references to their new addresses. The result is a contiguous region of live objects and a free region of contiguous memory.
The process typically consists of a mark phase, a sweep or scan phase to collect garbage, and
Historically, mark-compact has been used in languages and runtimes such as early Lisp and Smalltalk systems,