On Jun 20, 2010, at 4:24, "André Warnier" <a...@ice-sa.com> wrote:
>> The time it takes to perform a GC is *not* dependent on the number or >> size of dead objects, just on the live ones. > > That is counter-intuitive. Pray, why is that ? All modern GC algorithms are variations of mark-sweep-compact. The basic operation consists of following the object reference graph from a set of known roots (eg, thread stack frames), marking each discovered object with a found flag, and copying the found objects to an unoccupied area. Unreachable (dead) objects are never encountered, so their number or size does not come into play. The space occupied by dead objects is automatically reclaimed as live objects are copied over them. There are links to various papers and descriptions on the Java technologies page: http://java.sun.com/javase/technologies/hotspot/gc-index.jsp Googling for mark-sweep-compact will get you some of the academic papers and continuing research into the topic. - Chuck (Now in a hotel watching the All Whites vs the Azzurri.)