jvm-hotspot

JRockit JVM versus HotSpot JVM

末鹿安然 提交于 2019-11-27 01:00:17
问题 If anyone can give me brief information about the advantages and disadvantages of the two JVM since they all depend on the Standard JVM Specification. 回答1: JRockit was originally developed by Appeal and BEA Systems before being acquired by Oracle to run server software. 1 It was meant to be optimized for large applications requiring long running tasks, a lot of memory and a scalable environment, pushing optimizations for these scenarios even further than the Sun HotSpot JVM in server-mode

Does Java JIT cheat when running JDK code?

孤者浪人 提交于 2019-11-26 23:45:12
问题 I was benchmarking some code, and I could not get it to run as fast as with java.math.BigInteger, even when using the exact same algorithm. So I copied java.math.BigInteger source into my own package and tried this: //import java.math.BigInteger; public class MultiplyTest { public static void main(String[] args) { Random r = new Random(1); long tm = 0, count = 0,result=0; for (int i = 0; i < 400000; i++) { int s1 = 400, s2 = 400; BigInteger a = new BigInteger(s1 * 8, r), b = new BigInteger(s2

Analyzing gc logs

半世苍凉 提交于 2019-11-26 23:04:40
I am using -XX:+PrintGCApplicationStoppedTime and -XX:+PrintGCApplicationConcurrentTime options to turn on gc logging. But found that only after 4 0r 5 prints of PrintGCApplicationStoppedTime my actual details of gc logs printed through -XX:+PrintGCDetails command! By definition PrintGCApplicationStoppedTime prints application stopped time for every gc. But I am not clear why it prints like the example shown below. Is that because PrintGCApplicationStoppedTime just prints after every safe point reach (or) the log file will be logged by different gc threads. Im using Concurrent sweep for full

Java Exceptions counter on JVM HotSpot

家住魔仙堡 提交于 2019-11-26 22:30:55
I am wondering is it possible to log every exception which occurs on JVM level without changing application code? By every exception I mean caught and uncaught exception... I would like to analyze those logs later and group them by exception type (class) and simply count exceptions by type. I am using HotSpot ;) Maybe there is smarter why of doing it? For example by any free profiler (YourKit has it but it is not free)? I think that JRockit has exception counter in management console, but don't see anything similar for HotSpot. I believe there are free tools to do it, but even making your own

Difference between JVM and HotSpot?

六眼飞鱼酱① 提交于 2019-11-26 22:29:15
问题 What exactly is HotSpot and how does it relate to JVM and OpenJDK? Is it a library? What exactly does it do? Also, what is the difference between OpenJDK and HotSpot? 回答1: The definition of what exactly is a Java Virtual Machine is stated in the Java Virtual Machine Specification The JVM is by definition a virtual machine, i. e. a software machine that simulates what a real machine does. Like a real machine, it has an instruction set, a virtual computer architecture and an execution model. It

Read Java JVM startup parameters (eg -Xmx)

感情迁移 提交于 2019-11-26 21:43:08
I'm trying to figure out if there's a way to determine the JVM startup properties from within a running java process. Specifically I'm trying to find out where parameters such as -Xmx (max heap size) and -XX:MaxPermSize are stored. I'm running Sun's 1.6 jvm. If you're wondering why I want to do this, I have a number of JVM webservers that may or may not be configured correctly and I want to add this to the startup code check. It's much easier for me to check in a piece of java code that gets deployed everywhere than to manually find and check all of the jvm startup files. Right now the jvm

Why I can't create an array with large size?

試著忘記壹切 提交于 2019-11-26 16:41:38
Why it is impossible to create an array with max int size? int i = 2147483647; int[] array = new int[i]; I found this explanation: Java arrays are accessed via 32-bit ints, resulting in a maximum theoretical array size of 2147483647 elements. But as you can see my code doesn't work. It is also impossible to create an array with size new int[Integer.MAX_VALUE - 5]; Technical details 64-Bit HotSpot JVM OSX 10.10.4 PS And why -5 actually? Ivan Mamontov Theory There are two possible exceptions: OutOfMemoryError: Java heap space means your array does not fit into java heap space. In order to solve

What do -XX:-PrintGC and XX:-PrintGCDetails flags do?

空扰寡人 提交于 2019-11-26 16:27:46
问题 I found the JVM flags here. Is there a more detailed explaination of what exactly they do? 回答1: Setting this flags writes all the garbage collections made by the JVM to a log file (or stdout, but then it is less useful), and these can be analysed by tools such as the ones mentioned here. Using this information you can fine tune your garbage collection configuration. 回答2: Rather on Sun's, use -Xloggc:gc.log to log to a file, -verbose:gc is also a common switch for this. Also, ensure -XX:

What does the UseCompressedOops JVM flag do and when should I use it?

谁说我不能喝 提交于 2019-11-26 15:21:55
问题 What does the HotSpot JVM flag -XX:+UseCompressedOops do and when should I use it? What sort of performance and memory-usage differences will I see when using it on a 64-bit Java instance (vs. not using it)? 回答1: Most HotSpot JVM in the last year have had it on by default. This option allows references to be 32-bit in a 64-bit JVM and access close to 32 GB of heap. (more than 32-bit pointers can) (You can have near unlimited off heap memory as well). This can save a significant amount of

How does the JVM decided to JIT-compile a method (categorize a method as “hot”)?

别说谁变了你拦得住时间么 提交于 2019-11-26 12:56:32
I already worked with -XX:+PrintCompilation , and I know the basic techniques of the JIT-compiler and why JIT-compilation is used. Yet I still have not found out how the JVM decides to JIT-compile a method, i.e. "when the right time has come to JIT-compile a method". Am I right in the assumption that every method starts being interpreted, and as long as it is not categorized as "hot method" it will not be compiled? I have something in the back of my head that I read that a method is considered "hot" when it was executed at least 10.000 times (after interpreting the method 10.000 times, it will