Main causes of Out-Of-Memory Errors
Main causes of Out-Of-Memory Errors When there is no enough space to create a new object in heap JVM through a Out-of-memory errors before giving this error JVM surly runs garbage collector once to check for available memory which can be freed .The main causes for this error can be. It is possible that you have estimate less memory for your application for example your application need 2 Gb of memory but you have configured only 512 Mb so here you will get an OOME(Out-of-memory errors )
1.Due to Memoryleak :- Memory leak is responsible for decreasing the available memory for heap and can lead to out of memory error for more read What is a Memory Leak in java?
2.Memory fragmentation :- It is possible that there may be space in heap but it may be not contiguous . And heap needs compaction . Rearrange its memory.
3.Excess GC overhead :- Some JVM implementations, such as the Oracle HotSpot, will throw an out-of-memory error when GC overhead becomes too great. This feature is designed to prevent near-constant garbage collection—for example, spending more than 90% of execution time on garbage collection while freeing less than 2% of memory. Configuring a larger heap is most likely to fix this issue, but if not you’ll need to analyze memory usage using a heap dump
4.Allocating over-sized temporary objects:- Program logic that attempts to allocate overly large temporary objects. Since the JVM can’t satisfy the request, an out-of-memory error is triggered and the transaction will be aborted. This can be difficult to diagnose, as no heap dump or allocation-analysis tool will highlight the problem. You can only identify the area of code triggering the error, and once discovered, fix or remove the cause of the problem.
Comments
Post a Comment