JVM Memory Overflow/insufficiency/outofmemoryerror/garbage collection vicious circle is a problem that needs to be solved and is not uncommon.
Recommended to read the official T roubleshooting Guide forJava SE 6 with HotSpot VMS > troubleshooting Memory Leaks
- The first clear question -the GC log is the most accurate way to determine the memory problem, because the nature of the Java memory problem is the GC problem
- Heap Heap Insufficient overflow
- Stack stacks are out of overflow
- Perm heap Insufficient overflow-Java 8 canceled Perm
- The vicious circle of garbage collection-note: This is almost the most common phenomenon
- Stack stacks are out of overflow -error is Stackoverflowerror
The JVM will print out the specific Stack Trace
If the Stack is larger but not recursive, then-XSS (Server default 1024K)
If Stack Trace shows recursion, then modify the code
- Perm heap Insufficient overflow -OutOfMemoryError with PermGen space
Big-xx:maxpermsize, like 768m.
- Heap heap Insufficient overflow- OutOfMemoryError with Heap Space.
Solution: Adjust the-xmx, if large enough to debug-refer to the following debug HEAP
- The vicious circle of garbage collection- Note: This is almost the most common phenomenon
Phenomenon:
JVM does not correspond, memory basic consumption, analysis GC log, will see spent a long time to do FULLGC, released a bit of memory, and quickly need to FULLGC, such as 10 seconds to do fullgc,1 seconds and then need to FULLGC and then 10 seconds to complete FULLGC, repeated so.
Resolution: Adjust the-XMX, or debug-refer to the debug HEAP below
- DEBUG HEAP-It is recommended to catch heapdump and then analyze
- Crawl Heapdump-many methods, but commonly used as follows (note for non-IBM Java)
-xx:+heapdumponoutofmemoryerror-xx:heapdumppath=/path
--Configuration parameters memory overflow when automatically crawl, attention often memory problems appear as garbage collection vicious circle, that will not come out.
Jmap.exe-dump:format=b,file=heapdump.hprof <pid>
--Command fetching
Recommended Eclipse Memory Analyzer (http://www.eclipse.org/mat/)
Java performance-How to investigate and resolve memory issues