Mark-and-Sweep ...
After all cells that are in use have been marked, the Sweep phase is run. All memory cells are examined, in order of increasing address. Those cells that are not marked are pushed onto the Free List.
``Marking'' a cell may use an available bit within the cell, or it may use a separate bit table that uses one bit to represent each word.
Mark-and-Sweep garbage collection is conceptually simple. However, it requires time that is proportional to the total size of the address space, independent of how much garbage is collected. This is a disadvantage for large address spaces.
Another disadvantage of this algorithm is that all computation stops for several seconds while garbage is collected. This is not good for real-time applications, e.g., a robot walking down stairs.