Skip to main content
This is one method for garbage collection that is used with programming languages other than Java (for example, Python and Objective-C). As for generational garbage collection with Java, memory is managed separately on new and old memory areas, and garbage collection is performed by algorithms that suit the features of the data in each area.
When the system is performing some sort of processing, the data used in that processing is first placed on a new area. When that new area becomes full of data, garbage collection using an algorithm known as "copy garbage collection (GC)" is executed, and unnecessary data is erased from the new area. Furthermore, in the case of long-lifetime data that underwent garbage collection a certain number of times, the data is moved to an old area. In this manner, the available space on the new area is increased, and new data can be arranged in it.
On the other hand, if the old area becomes full with data moved from the new area, garbage collection which targets all areas ("full" GC) is executed. With full GC, the unnecessary data is erased from all areas, and data is relocated.