How to detect the cause of OutofMemoryError?

后端 未结 5 1871
慢半拍i
慢半拍i 2021-02-08 11:44

I have a complaint that a server application of mine is crashing on high load.
It is a web app running in Tomcat 5.
I see the thread dumps and I see that th

5条回答
  •  长发绾君心
    2021-02-08 11:59

    According to this post:

    There are two possible causes of the java.lang.OutOfMemoryError: Failed to create a thread message:

    • There are too many threads running and the system has run out of internal resources to create new threads.
    • The system has run out of native memory to use for the new thread. Threads require a native memory for internal JVM structures, a Java™ stack, and a native stack.

    So this error may well be completely unrelated to memory, just that too many threads are created...

    EDIT:

    As you've got 695 threads, you would need 695 times the stack size as memory. Considering this post on thread limits, I suspect that you are trying to create too many threads for the available virtual memory space.

提交回复
热议问题