How to detect the cause of OutofMemoryError?

后端 未结 5 1882
慢半拍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条回答
  •  猫巷女王i
    2021-02-08 12:13

    A similar message on IBM WebSphere shows this line

    "Failed to create a thread: retVal"

    as indicative of a native OOM which means some thread (of the process) is trying to request a large portion of memory on the heap.

    The IBM link above has a series of steps - some of which are IBM specific. Have a look.

    From a native memory usage perspective:

    • Maximum Java heap settings
    • JDBC driver
    • JNI code or Native libraries
    • garbage collection of unused classes. Ensurethat -Xnoclassgc is not set.
    • Thread Pool settings (fixed size thread pools)
    • Too many classloaders etc, but these are not very common.
    • Number of classes/classloaders from javacores.

    Another thing you could look at is the PermGenSpace - how large is it?

    This link http://www.codingthearchitecture.com/2008/01/14/jvm_lies_the_outofmemory_myth.html suggests

    Increasing the heap allocation actually exacerbates this problem! It decreases the headroom the compiler, and other native components, have to play with. So the solution to my problem was: 1.reduce the heap allocated to the JVM. 2. remove the memory leaks caused by native objects not being freed in a timely fashion.

    Also have you configured a value in server.xml for maxThreads ? The default is 200 but your app seems to have 695 ?

提交回复
热议问题