Categories
Java Technology

Java Garbage Collection

<h2>TLAB and the Cost of Object Allocation</h2> To avoid contention each thread is assigned a Thread Local Allocation Buffer (TLAB) from which it allocates objects. Using TLABs allows object allocation to scale with number of threads by avoiding contention on a single memory resource. Object allocation via a TLAB is a very cheap operation; it […]

            <h2>TLAB and the Cost of Object Allocation</h2>

To avoid contention each thread is assigned a Thread Local Allocation Buffer (TLAB) from which it allocates objects. Using TLABs allows object allocation to scale with number of threads by avoiding contention on a single memory resource. Object allocation via a TLAB is a very cheap operation; it simply bumps a pointer for the object size which takes roughly 10 instructions on most platforms. Heap memory allocation for Java is even cheaper than using malloc from the C runtime. When a TLAB is exhausted a thread simply requests a new one from the Eden space. When Eden has been filled a minor collection commences.  [ref]

Weak References explained.