Posted by dym on January 20, 2014

本文迁移自老博客,原始链接为 https://seven.blog.ustc.edu.cn//

Through a large number of programs, we can found that most of the newly created objects have a very short survival time.In other words, the objects have only a short life cycle. This finding has been used to help optimize garbage collection. The partition of objects into different generations (time intervals) based on time of allocation, and giving them different GC policies depending on age. Based on the heuristic (often true in practice) that most objects are discarded shortly after being used–hence the GC is tuned to get rid of those first. Generational collector is a better choice because in generational collection, object that are referenced from older memory regions are promoted to the next high region,the older memory regions be recycled less frequently ,it’s efficient.