JVM: Java Heap & Stack
When does Heap gets created? Heap gets create on the startup of JVM. What is Heap structure (young space/nursery and old space) When an object created it is first stored and placed on young space or nursery and if it lives there for longer time it is moved to old space. The design goal behind young space and old space is that newly created objects are short lived and since they are placed on young space their access is faster. How memory is allocated to Objects? While assigning memory on Heap, Objects are first identified whether they are small or large? Small objects are allocated in Thread Local Areas (TLA). TLA are free chunk of space reserved from Heap and is given to thread for exclusive use. Thread can then allocate objects in its TLA without synchronizing with other threads. When the TLA becomes full, the thread simply requests a new TLA. The TLAs are reserved from the nursery if such exists; otherwise they are reserved anywher...