How to generate thread dump java on out of memory error?
Your question can be simplified into: • how to generate a thread dump and: • how to catch an out of memory error (don’t pay attention to naysayer here, they’re missing the bigger picture, see my comment) So it’s actually quite easy, you could do it like this: • install a default uncaught exception handler • upon catching an uncaught exception, check if you have an OutOfMemoryError • if you have an OutOfMemoryError, generate yourself a full thread dump and either ask the user to send it to you by email or offer to send it automatically Bonus: it works fine on 1.5 too 🙂
Related Questions
- Why does my application sometimes receive a NativeSeqFile error when using JRIO and the Remote Method Invocation (RMI) - Java Remote Method Protocol (JRMP) to access MVS datasets?
- I am getting the error "java.lang.OutofMemoryError Java heap space", Is there a way I can increase the memory for the program?
- I downloaded Java and got the error: "Unable to initialize threads -- cannot find class java/lang/thread". What should I do?