JVM memory leaks (OOM)! Secret with you one [first] bomb

We will introduce into multiple memory leaks OOM content, generally routine for the phenomenon, causes, solutions. Simple and clear, do not play on tall. Remember to look forward, ha ha


OOM most typical performance: java.lang.OutOfMemoryError, you remember it?


One 1 OOM phenomenon

Today introduces the first Java heap space


2 What causes it?

1) application attempts to add more data into the heap space, but there is not enough space for it, when the JVM heap size limit reached, will trigger Java heap space error


2) the amount of data proliferation. When the number of users or amount of data suddenly peaked and is expected to exceed the threshold, before the peak of the normal operation of the operation will stop running and trigger java.lang.OutOfMemoryError: Java heap space.


3) memory leak. Bad programming code error will result in your application continues to consume more memory. Every time certain objects remain in the Java heap space. Over time, the leaked objects will consume all available Java heap space.


3 how to solve and avoid it?

1) heap allocation of memory to the JVM reasonable.


2) However, in many cases, provide more Java heap space will not solve the problem. For example, if the application contains a memory leak, even add more heap will only postpone the error. In addition, the increase Java heap space also tends to increase the number of GC pause time, thus affecting the throughput or latency applications.


3) If you want to solve the fundamental problem Java heap space and not mask the symptoms, you need to figure out which part of the code responsible for most of the allocated memory. In other words, you need to know which objects occupy most of the space stack and try to optimize their


Well, here today, the second bomb to meet tomorrow ~


Guess you like

Origin blog.51cto.com/xqtesting/2481503