Questions tagged [jvm-hotspot]

HotSpot is the standard Java virtual machine used by both the Oracle and OpenJDK Java runtime environments.

HotSpot is the standard Java virtual machine used by both the Oracle and OpenJDK Java runtime environments for Java SE and EE environments.

This makes it the most widely deployed Java virtual machine in the world.

It is capable of running code from any language which can emit a Java .class file, as well as interpreted languages (e.g. JRuby) which have implemented their interpreters in Java (or another JVM language).

As of 2012, there are at least 200 languages which can run on top of the JVM - including Scala, Groovy, Clojure, JRuby, Jython and many smaller, niche languages.

HotSpot gets its name from the ability to dynamically profile running code and detect the "hot spots" of execution - the most commonly executing methods.

As, under most circumstances, programs spend most of their time in a small percentage of their methods, this focusing of optimization effort on the hot methods is very efficient.

HotSpot compiles and aggressively optimizes these hottest methods to highly platform-specific machine code which is specialized for the exact environment the code is running on.

This ability to use information about the runtime environment (precise instruction sets supported, memory and core configuration, etc) allows HotSpot to perform optimization tricks that are just not possible with a generic ahead-of-time strategy for "i386" or "i686" as is commonly seen in C/C++ environments.

This (along with the JVMs advanced memory management and garbage collection subsystem) makes the performance analysis of HotSpot-hosted programs more difficult compared to well-known techniques for C/C++. Direct comparison between the two environments is difficult - they each have individual strengths, and each has areas where they have definite advantages.

696 questions
9
votes
1 answer

Why throwing an exception tries to loads the class which extends Exception (though it is not executed) but not a regular class

I have the below classes. I have manually compiled the classes using javac and ran the Driver class. Later removed the entity.class and MyCustomException.class and ran the app like below. java Driver test The below error is complained about…
Shiva
  • 1,962
  • 2
  • 13
  • 31
9
votes
1 answer

How java object locking and monitor creation happens internally inside JVM

Suppose I have following code snippet with two threads accessing same method with two critical sections (synchronized statements). Each of these synchronized statements is given a different lock object. Code as follows : public class MyWorker…
Insightcoder
  • 506
  • 4
  • 14
9
votes
1 answer

Java primitive array layout in memory

Here are the two samples I would like to base my question on (assuming you have JOL here): Layouter layout32Bits = new HotSpotLayouter(new X86_32_DataModel()); Layouter layout64BitsComp = new HotSpotLayouter(new X86_64_COOPS_DataModel()); And an…
Eugene
  • 117,005
  • 15
  • 201
  • 306
9
votes
3 answers

Is it possible to monitor "Full GC" frequency in JMX (on HotSpot)?

I want to monitor Full GC frequency in JMX. A MBean exposes GC count. (cf. http://download.oracle.com/javase/1.5.0/docs/api/java/lang/management/GarbageCollectorMXBean.html - java.lang:type=GarbageCollector,name=). The problem is that MBean does…
ajeanson
  • 2,580
  • 4
  • 19
  • 17
9
votes
1 answer

How to retransform an executing method with JVMTI agent which has no further invocations?

I am instrumenting a class file during runtime for various purposes. I'm using a JVMTI agent to that end. My strategy to instrument a method is to call RetransformClasses function to invoke ClassFileLoadHook. This strategy works fine for all the…
Saqib Ahmed
  • 1,056
  • 14
  • 33
9
votes
1 answer

What's this new column in -XX:+PrintCompilation output?

While using -XX:+PrintCompilation recently (JDK 8r111) to examine method compilation, I noticed a new column which doesn't appear in the documentation I can find on the topic: this column | | …
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
9
votes
2 answers

Disable Java JIT for a specific method/class?

I'm having an issue in my Java application where the JIT breaks the code. If I disable the JIT, everything works fine, but runs 10-20x slower. Is there any way to disable the JIT for a specific method or class? Edit: I'm using Ubuntu 10.10, getting…
Ralf
  • 14,655
  • 9
  • 48
  • 58
9
votes
2 answers

What is the size of methods that JIT automatically inlines?

I've heard that JIT automatically inlines small methods, like getters (they have about 5 bytes). What is the boundary? Is there any JVM flag?
user123454321
  • 1,028
  • 8
  • 26
9
votes
2 answers

Java remote debugging overhead

I just wonder about additional overhead of remote debugging. I start application using HotSpot with these parameters: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 I heard about large impact on performance in much older…
Tymur Yarosh
  • 553
  • 1
  • 6
  • 19
9
votes
1 answer

Loop optimizations Oracle Java 7-8 Hotspot VM

I would like to know what are the loop optimizations performed by Oracle Java 7 (or 8) Hotspot VM?
El Marce
  • 3,144
  • 1
  • 26
  • 40
9
votes
2 answers

How do I check assembly output of Java code?

I found this question that answered it for C++: How do you get assembler output from C/C++ source in gcc?
9
votes
1 answer

How does the dynamic tenuring threshold adjustment work in HotSpot JVM?

So far I know that: Objects are allocated in the eden space and if they survive a minor collection they get promoted to one of the survivor spaces For further minor collections objects' that survive minor collections are swaped between the two…
9
votes
1 answer

Is the permanent generation always collected serially on the HotSpot VM?

From reading a rather mature Oracle blog entry, I learned that (...) the permanent generation is currently collected serially. However, this blog entry is from quite some years ago and I was wondering how the recent advancements in garbage…
Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192
9
votes
1 answer

Why can you throw anything in Java?

In Java theoretically you can throw only Throwables. This is allowed by the language and checked during class-loading. But if you disable class checking java -Xverify:none -cp . BadClassThatCompiles then you can run a class that throws any class…
8
votes
3 answers

How to understand Java Hotspot Errors

Guys when the JVM Crashes it writes an Error Log hs_err_pid.log. I want to find out what caused the JVM to crash ? How to understand these Logs, is it documented anywhere on how this Log is arranged. I tried to search on the Net but to no avail…
Geek
  • 23,089
  • 20
  • 71
  • 85