java.lang.OutOfMemoryError: requested 1958536 bytes for Chunk::new. Out of swap space

后端 未结 3 875
半阙折子戏
半阙折子戏 2020-12-16 22:23

We are facing the below problem at our production enviournment in unpredictable manner sometimes the server is down in a day or sometimes in a week, below is the exact error

相关标签:
3条回答
  • 2020-12-16 22:50

    You're running with a lot of JVM args that affect memory. Have you tried empirically removing each option to see which one is causing the OOM? This particular OOM is not coming from the Java heap, it's coming from the JVM's own C heap.

    0 讨论(0)
  • 2020-12-16 22:53

    For the record (and Google), this looks like both these bugs, which were fixed in the 1.6u22 release of sun's jdk. So, first thing to do is update your JVM. If it still happens, and always happens on a particular method, you can exclude that method from compilation (as long as you're aware of the performance implications of that) with the following jvm flag:

    -XX:CompileCommand=exclude,org/apache/velocity/runtime/directive/Foreach,render
    

    (as suggested here). But, first update your jvm.

    0 讨论(0)
  • 2020-12-16 22:54

    As stated by the other answers / comments, you are running out of memory. Given your JVM settings, I'd say that the root cause is 99% likely to be a memory leak.

    If you have been doing a lot of hot loading in the Tomcat instance, this could just be caused by that. Hot loading is notorious for leaking memory, and there is not much you can do about it in practice ... except exit and restart your Tomcat more often.

    The other possibility is that your application is leaking memory. If this is the case then you will need to use a memory profiler to track down the leak.

    The fact that the OOME caused a JVM crash is interesting, but probably not significant. (It looks like the JVM was trying to JIT compile a class generated from a JSP when it ran out of memory. The chunk being requested is rather large, but that probably means you have a rather large / complicated JSP.)

    0 讨论(0)
提交回复
热议问题