Performance Testing

A Glimpse on JAVA Memory


I just want to share my experience in performance issues that occurred due to Java heap memory.
Before that a few points to recollect about Java memory.
Heap memory is where java run time objects are getting allocated.
Non-Heap is the place of loaded classes and other meta data.

1) What will be the impact of loaded java heap memory?
JVM automatically collects and free memory using Garbage Collector. When the Object is referred, jvm considers it as Live object and it will not be Garbage collected . Even it might be getting referenced due to the bug in the product/software that is developed. Over time , the number and size of the oject will increase , occupy full memory and application will stop saying JAVA : Out of Memory : Heap Space

2) What will be the impact of loaded java Non-heap memory?

Application will hang by throwing the eror ” JAVA : Out of Memory : Non-Heap Space”

3) How to rectify java out of memory Issues?
For any enterprise application ~3GB to ~4GB of heap memory should be allocated based on the complexity of the code it is running on. If it occurs even after increasing then it should be profiled using profiler tools such as YJP. Similarly ~256MB-~500MB can be allocated for Non-heap memory.
Refer the below link for profiling using YJP:

Leave a Reply

Your email address will not be published. Required fields are marked *