InterviewSolution
| 1. |
Heap Space in Java |
|
Answer» The Heap Space in Java is allocated the memory to the Objects and the JRE classes by the Java runtime. All the objects in the application are created in the heap space. The objects in the heap space are GLOBALLY accessible from any place in the application and so they have a lifetime for the whole application execution. The Memory Model of the heap space is divided into parts known as generations. Details about these are given as follows: 1. Young Generation All the new objects are allocated in the young generation and they age here. When this place fills up, then minor garbage collection occurs. 2. Old Generation All the longer existing objects are stored in the old generation. When objects in the young generation reach a certain age threshold, they are MOVED to the old generation. 3. Permanent Generation The Java metadata for runtime classes is stored in the permanent generation,. Some of the important features of Heap space in Java are given as follows:
Some of the differences between stack memory and heap memory are given as follows:
|
|