How to know who kills my threads

后端 未结 15 701
南旧
南旧 2020-12-05 00:19

I got a thread that is just banishing.. i\'d like to know who is killing my thread and why.

It occurs to me my thread is being killed by the OS, but i\'d like to

15条回答
  •  攒了一身酷
    2020-12-05 01:00

    It could be throwing one of the various uncatcheable exceptions including Stack Overflow or Out of Memory. These are the hardest exceptions to track down.

    What does memory consumption look like while this thread is running? Can you use a memory profiler on it to see if it's out of control? Can you add some logging in inner loops? If you have a recursive method, add a counter and throw an exception if it recurses an impossible number of times. Are you using large objects that could be causing large object heap fragmentation (causes out of memory errors even when you aren't really out).

提交回复
热议问题