Diagnose
- add -XX:+HeapDumpOnOutOfMemoryError to dump Java heap
- use jmap while the process is runnin:
- jmap -histo:live pid
- jmap -dump pid
- use jhat or Eclipse MAT to analyse the heap dump file
Solutions
- Analyse the heap dump to find what objects were consuming memory
- Increase Java heap size: -Xmx1g
- To reduce the memory usage, add -XX:+UseG1GC -XX:+UseStringDeduplication arguments to java command
No comments:
Post a Comment