OOM-killer with Java application on Linux

淺唱寂寞╮ 提交于 2019-12-03 16:27:27

So you're leaking memory and would like to know why and where.

A few things you can do

  • use garbage collection logging with all the verbose options
  • use the jdk tools (jmap with the histo option shows you which classes have how many instances alive etc)
  • jkd tools #2 jvisualvm - on of the best free tools around
  • there are free versions of commercial tools like appdynamics lite/ jxinsight opus
  • use -XX:+HeapDumpOnOutOfMemoryError and analyse the heap dump once you get the OOM
  • a code review can't do harm either - most likely you're not letting go of information you don't need any more

You probably have a memory leak. I suggest you to use a profiler tool (JProfiler is the best in my opinion) to find it. If your server doesn't have GUI you can set up the profiler remotely and use an agent on the Linux machine.

kris

Too late a response. 500 is too less but why not use Xms and Xmx settings for Java? That way you don't leave the System Kernel to decide what to do.

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