Java / Garbage collection
Explain the structure of heap.
Heap is divided into different generation, for example, new (young) generation, old generation and PermGen space.PermGen space is used to store class metadata and over filling of PermGen space can cause java.lang.OutOfMemoryError:PermGen space.
Young Generation : It is place where lived for short period and divided into 2 spaces:
- Eden Space : When object created using new keyword memory allocated on this space. Survivor Space : This is the pool which contains objects which have survived after java garbage collection from Eden space.
Old Generation : This pool is basically contain tenured and virtual (reserved) space and will be holding those objects which survived after garbage collection from Young Generation.
- Tenured Space: This memory pool contains objects which survived after multiple garbage collection means object which survived after garbage collection from Survivor space.
Permanent Generation : This memory pool as name also says contain permanent class metadata and descriptors information so PermGen space always reserved for classes and those that is tied to the classes for example static members.
In Java8, PermGen is replaced with Metaspace which is very similar. Main difference is that Metaspace re-sizes dynamically.
Code Cache (Virtual or reserved) : HotSpot Java VM includes code cache area that has memory which will be used for compilation and storage of native code.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
