How to troubleshoot Out Of Memory error on Production system

送分小仙女□ 提交于 2019-11-30 16:59:28

You can try to do memory dumps with jmap (in tags you mentioned java 5 so this should be possible). Do several dumps when the server still works (like every hour or so).

Then analyze them in Eclipse MAT. Search for objects, or collections of objects that grow bigger on every dump. This will most probably be your memory leak.

I see two options, each of them having their pros and cons:

  1. Install a profiler agent and connect a profiler on your application. This has of course some serious performance impact which may be not acceptable in your production environment. But this would allow you to monitor the application and perform a memory dump when Heap space is almost full.

  2. Reproduce your production environment elsewhere and also use a profiler. If your issues only appear with big loads, you may have to create load tests so that you reach the OOME.

Using a profiler is your best chance to find memory leaks.

Otherwise, you can always try to perform static code reviewing, using PMD and Findbugs (amongst other static analysis tools) which may spot some mistakes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!