The JVM runtime environment uses a large memory pool called the heap for object allocation. The JVM automatically invokes garbage collections in order to clean up the heap of unreferenced or dead objects. In contrast, memory management in legacy programming languages like C++ was left to the programmer.
If the JVM heap settings are not set correctly, the garbage collection overhead can make the system appear unresponsive. In the worst case, your transactions or the JVM could abort due to OutOfMemory exceptions (please see OutOfMemory exceptions).
In the past, garbage collection overhead was quite substantial and the impact to end-user response times noticeable. Many garbage collection techniques have been proposed and implemented - all with their own strengths and weaknesses. Garbage collection techniques are constantly being improved. For example, the Sun JVM supports a mainly "stop-the-world" garbage collector - all transactions have to pause in a safe point for the entire duration of the garbage collection. The Sun JVM supports a parallel concurrent collector where transactions can continue running during most of the collection.