Combat Java Virtual Machine Four: Improve performance, disable System.GC ()?

Source: Internet
Author: User

Today began the actual combat Java Virtual Machine four: "Disable System.GC ()".

Total of 5 Series

  • "Heap overflow processing" in one of the actual Java virtual machines
  • Virtual machine working mode for Java Virtual machine
  • The three "G1 of the New generation GC" of Java Virtual machine
  • Live Java Virtual machine Four "Disable System.GC ()"
  • Real-time Java Virtual Machine Five "turn on JIT compilation"

By default, System.GC () explicitly triggers the full GC directly, while recycling the old and new generations. In general, we believe that garbage collection should be automated without the need for manual triggering. If garbage collection is triggered too frequently, there is no benefit to system performance. Therefore, the virtual machine provides a parameter DISABLEEXPLICITGC to control whether the GC is triggered manually.

The implementation of System.GC () is as follows:

Runtime.getruntime (). GC ();

RUNTIME.GC () is a native method that is eventually implemented in Jvm.cpp, as follows:

Jvm_entry_no_env (void, jvm_gc (void)) Jvmwrapper ("jvm_gc");  if (! DISABLEEXPLICITGC) {   universe::heap ()->collect (GCCAUSE::_JAVA_LANG_SYSTEM_GC);  } Jvm_end

As you can see, if-XX:-+DISABLEEXPLICITGC is set, the conditional judgment cannot be established, then the explicit GC is disabled, so that System.GC () is equivalent to an empty function call.

Excerpt from

Combat Java Virtual Machine Four: Improve performance, disable System.GC ()?

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.