In Java, is it possible to accurately find the point at which java.lang.OutOfMemoryError occurred?
I am looking to better understand exactly how much memory did my application took a claim to before failing
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you could catch the OutOfMemoryError and ask the runtime as shown below.
(an OutOfMemoryError should occur when the heap runs out of memory)
if you have no idea where in your code it will fail, you could try register a shutdown hook and output the heapSize there.