In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "introduction to the logo of the JVM command line". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1.DisableExplicitGC
As long as you run grep quickly across code, you'll find the problem shown in listing 1-- the original Java performance anti-pattern:
Listing 1. System.gc ()
/ / We just released a bunch of objects, so tell the stupid / / garbage collector to collect them already! System.gc ()
Explicit garbage collection is a very bad idea-it's like locking you in a phone booth with a crazy bulldog. Although the syntax of the call is implementation-dependent, if your JVM is running a generational garbage collector (mostly) System.gc (); force VM to perform a heap "sweep all", although some are not necessary. Full cleaning is several orders of magnitude more expensive than a regular GC operation, which is a simple math problem.
You can ignore my words-- Sun engineers provide a JVM flag for this particular human error;-the XX:+DisableExplicitGC flag automatically converts the System.gc () call into an empty operation, giving you the opportunity to run the code and see for yourself whether System.gc () is harmful or good for the entire JVM execution.
2.HeapDumpOnOutOfMemoryError
Not all VM supports all command-line flags, except for Sun/Oracle 's VM. The best way to find out if a flag is supported is to try it and see if it works properly. If these logos are not technically supported, you take full responsibility for using them. If any of these flags makes your code, your data, your server, or everything else disappear without a trace, I, Sun/Oracle, and IBM will be irresponsible. Just in case, it is recommended to experiment in a virtual (very productive) environment first.
What you want at this point is to take a snapshot of the heap when JVM dies-- just in time-- the XX:+HeapDumpOnOutOfMemoryError command can do this.
Run this command to tell JVM to take a "heap dump snapshot" and save it in a file for processing, usually using the jhat utility. You can use the appropriate-XX:HeapDumpPath flag to specify the actual path to the saved file. (no matter where the file is saved, make sure that the file system and / or Java process must have permissions configured to write to it. )
3.bootclasspath
It is helpful to put a class into the classpath on a regular basis, which is slightly different from the classpath that comes with the inventory JRE or the JRE classpath that is extended in some way. If you want to extend JRE, your customized implementation must be able to use the bootstrap program ClassLoader, which can load java.lang.Object and all its related files in rt.jar.
Although you can illegally open rt.jar and move your custom implementation or new packets into it, you technically violate the agreement you agreed to when you downloaded JDK.
Instead, use JVM's own-Xbootclasspath option, as well as skins-Xbootclasspath/p and-Xbootclasspath/a.
-Xbootclasspath allows you to set up the full bootstrap classpath (which usually includes a reference to rt.jar), as well as some other JAR files that come with JDK (not part of rt.jar). -Xbootclasspath/p prepends the value to the existing bootclasspath and appends-Xbootclasspath/a to it.
For example, if you modify the java.lang.Integer in the library and put the change under a subpath mods, the-Xbootclasspath/amods parameter puts the new Integer before the default parameter.
4.verbose
-verbose is a useful first-level diagnostic utility for virtual or any type of Java application. The flag has three child flags: gc, class, and jni.
When developers try to find out if the JVM garbage collector is malfunctioning or causing poor performance, the first thing to do is usually to execute gc. Unfortunately, interpreting gc output is cumbersome-enough to write a book. To make matters worse, the output printed on the command line changes in different Java versions or not in different JVM, making it harder to interpret correctly.
In general, if the garbage collector is a generational collector (most "enterprise" VMs is). Some kind of virtual flag will appear to indicate a full sweep of the GC path; in Sun JVM, the flag begins the GC output line with "[FullGC...]" The form appears.
Class can be a great help in diagnosing ClassLoader and / or mismatched class conflicts. It reports not only when the class is loaded, but also where the class is loaded, including the path to JAR (if from JAR).
Jni is rarely used, except when using JNI or local libraries. When turned on, it reports various JNI events, such as when the local library is loaded and when the method is bounced back; again, the output changes in different JVM versions.
5.Command-line-X
-Xint, running JVM in interpreted mode (useful for testing whether the JIT compiler actually works on your code or for verifying that there is a bug in the JIT compiler).
-Xloggc:, and-verbose:gc do the same thing, but record a file instead of outputting it to the command line window.
JVM command-line options change from time to time, so it's a good idea to review them regularly.
This is the end of the introduction to the logo of the JVM command line. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.