Skip to main content

Thread-Local Heaps

Java Memory Management


At the base of the thread-local heap (TLH) memory management scheme is the assumption that most objects are created and used by a single thread. If the system can recognize such thread-local objects automatically, it can avoid stopping other threads and taking expensive locks when collecting them. In our design, each thread receives a portion of the heap in which it allocates its objects and in which it garbage-collects thread-local objects without synchronization with other threads. Objects are dynamically monitored to determine if and when they turn from thread-local to global, which can be collected only with a full stop-the-world GC.

We implemented thread-local heaps for the Windows NT JVM without JIT (Just in Time). Results show a 50% – 80% reduction in the number of full garbage collections (and the long pauses associated with them). Performance results ranged from a small increase (~.5%) to a small decrease in execution time. The better results on both counts were obtained for benchmarks with a high GC overhead. In some cases, GC time was reduced by as much as 59%, but this gain was mostly offset by the overhead incurred by the dynamic monitoring of objects (write barrier).

There are a number of technical challenges that need to be overcome before a complete implementation can be made available. The project is currently (2002 Q1) being reevaluated for continuation.

A paper that describes this collector appears in ISMM'02 [10].