Garbage collection on Java VMS

Source: Internet
Author: User
Tags garbage collection

There is a difference between the automatic collection of the Sun JVM and the programmatic explicit invocation of System.GC ().

Automatically recycled thread level is the lowest, if the system is more and more busy, more and more pressure, then automatically recycled threads will be running the opportunity to become smaller, or even not run, the result is that memory can not be released;

The use of programming calls to System.GC () is not recommended because garbage collection the system hangs, and the programming call is usually handled regularly, and the user line level is higher than 5, that is sure to be run (this I used, the recovery effect is obvious, J2ME friend will certainly have a deeper understanding), So the system will also be suspended periodically, it will affect the system's response, but it is not obvious.

Second, to sum up, in the appropriate time to call System.GC () two times is appropriate, pay attention to "two" is only personal experience, we can test.

Third, in addition, the sun JVM is only suitable for the development environment, that is, start speed reading faster,

In a product or production environment, I recommend that you use the Jrocket VM, which can be downloaded free of charge from the official website of BEA, which not only has parallel and generational garbage collection (that is, the garbage collection thread and the user thread have the same priority and can run simultaneously without suspending the system , garbage collection has a finer granularity level, and can greatly improve the performance of the system.

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.