Possible reasons for the automatic exit of a Java program when it is running for a long time

Source: Internet
Author: User
Tags exit memory usage

I have a Java program that starts with seven threads, all of which are shaped like this:

public void run() {
while (true) {
try {
......
} catch (Throwable t) {
t.printStackTrace();
}
}
}

But often running, running for a few hours after the Java exit, what may be the reason?

I guess it was my own code or where I used the library to invoke System.exit (), but I hook the system.exit () with the program, and found that no one called the function. This server is the only one I use, and no one will kill. Java people to help think about what else might be the reason?

Reply:

If it is applied, there are generally 2 possible

1 JVM bugs, this simple, upgrade your JVM just fine

2 memory overflow, oh, I guess this is the most likely. You should start the tool to monitor the program's memory usage, jconsole.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.