space to availability list the garbage collection may occur when small amount of free space is left in the system or no free space is left in the system or when cpu is idle and has time to do the garbage collection compaction one preferable solution to garbage collection is compaction the process of moving all marked nodes to one end of memory and all available memory to other end is called compaction algorithm which performs compaction is called compacting algorithm