Next: Garbage collector


Java memory management: garbage collection and allocation

 

+

Search Tips   |   Advanced Search

Overview

The memory management component of the Java runtime environment is composed of...


Heap

The heap is a contiguous section of virtual memory where all the Java objects in a running JVM are stored. The maximum size of the Java heap is preallocated when the JVM starts.

Another memory area that Java uses is the system (or native) heap where allocations from application JNI code, compiled JIT code, and threads to map to Java threads, among other things are stored. The Java heap is commonly referred to as "the heap."


Allocator

All running threads have a local allocation buffer (cache). The cache block for all threads is sometimes called the thread local heap (TLH). Objects are allocated from the TLH if possible; if this is not possible, then a locked heap allocation is performed. If many allocations occur at once, then heap lock can become an issue. GC policies try to avoid heap lock through unique allocation algorithms.