By dannycoward on Nov 12, 2008
Like using the living room as the kids play area, tidying up, or garbage collection, is an integral part of life in the JVM. Except that the kids are applications and the toys on the floor the objects they create. But unlike in your living room, these kids don't sleep, are always playing with something, will scream if they have to wait while you tidy up, and will get seriously, seriously mad if they lose a toy. So how can you organize the mess they make without disrupting the game ?
The HotSpot team has been quietly working on a new algorithm, called Garbage First, for tidying up the memory space in the JVM while the kids are playing, as a replacement for the existing parallel and concurrnet mark sweep collectors. By dividing the living rooms into equal squares, it turns out that for most games, many of the squares contain unused toys that can be safely put away. By picking the low hanging fruit in this way, the new collector can work more predictably, and be given directives to operate within given time slices, which it can follow most of the time. And of course, being fully concurrent, its ready made for multiple cores.
And you can try it out because they quietly slipped it into the latest build of JDK 7.
Tony was interviewed at length about it at JavaOne 2008, and you can read more descriptions by Kirk, Alex, Charles, or get the full description in this paper.