Speeding it up and making it scale

This section addresses what a modern runtime can do to speed up memory management, going from impractical and "academic" algorithms to real world performance.

Thread local allocation

One technique, used in JRockit, that significantly speeds up object allocation is the concept of thread local allocation. It is normally much cheaper to allocate an object locally in a buffer in the running Java thread than going through the synchronized process of placing it directly on the heap. A naive garbage collector doing direct heap allocations would need a global heap lock for each allocation. This would quickly be the site for a nightmarish amount of contention. On the other hand, if each Java thread keeps a thread local ...

Get Oracle JRockit now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.