developerWorks: Mash that Trash--Incremental Compaction in the IBM JDK Garbage Collector
Jun 26, 2003, 07:00 (1 Talkback[s])
(Other stories by Aruna Kalagnanam, Sripathi Kodi)
"Java applications do not have memory management issues, because
the garbage collector of the Java Virtual Machine (JVM) takes care
of all the storage issues. The garbage collector in the IBM JVM is
based on the mark-sweep-compact (MSC) algorithm, where garbage
collection (GC) takes place in three phases. At the end of the mark
and sweep phases, free space is available, but there is a
possibility of heap fragmentation. The compact phase alleviates the
fragmentation problem by moving chunks of allocated space towards
the lower end of the heap, helping create contiguous free memory at
the other end.
"Since the advent of 64-bit operating systems, applications have
had the liberty to use large heaps. With Java applications using
large heaps, compaction of the heap takes quite a lot of time,
during which the application will not be able to do anything else.
This period of time is called pause time. Pause times of 40 seconds
are quite possible for compaction of a 1 GB heap. Such long pause
times are often unacceptable for real-time applications.
Incremental compaction (IC) is a way of reducing pause times. IC
also reduces the 'dark matter' in a heap, which we'll discuss in
the next section..."