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
18
votes
7 answers

Is there a Java bytecode optimizer that removes useless gotos?

Problem: I have a method that compiles to over 8000 bytes of Java bytecode. HotSpot has a magic limit that makes the JIT not kick in for methods that exceed 8000 bytes. (Yes, it is reasonable to have a huge method. This is a tokenizer loop.) The…
hsivonen
  • 7,908
  • 1
  • 30
  • 35
18
votes
5 answers

Too Low CPU Usage of Multithreaded Java Application on Windows

I am working on a Java application for solving a class of numerical optimization problems - large-scale linear programming problems to be more precise. A single problem can be split up into smaller subproblems that can solved in parallel. Since…
Nils
  • 818
  • 7
  • 16
18
votes
2 answers

What exactly is considered a garbage collection root and how are they found in the HotSpot JVM?

Intro: At university one learns that typical garbage collection roots in Java (and similar languages) are static variables of loaded classes, thread-local variables of currently running threads, "external references" such as JNI handles, and…
Markus Weninger
  • 11,931
  • 7
  • 64
  • 137
18
votes
4 answers

.NET runtime vs. Java Hotspot: Is .NET one generation behind?

According to the information I could gather on .NET and Java execution environment, the current state of affairs is follows: Modern Java VM are capable of performing continuous recompilation, which combined with profiling can yield great…
Dan
  • 11,077
  • 20
  • 84
  • 119
18
votes
5 answers

Why do I get OutOfMemory when 20% of the heap is still free?

I've set the max heap to 8 GB. When my program starts using about 6.4 GB (as reported in VisualVM), the garbage collector starts taking up most of the CPU and the program crashes with OutOfMemory when making a ~100 MB allocation. I am using Oracle…
Aleksandr Dubinsky
  • 22,436
  • 15
  • 82
  • 99
18
votes
2 answers

Using Concurrent Mark Sweep garbage collector with more than 120GB RAM

Has anyone managed to use the Concurrent Mark Sweep garbage collector (UseConcMarkSweepGC) in Hotspot with more than 120GB RAM? The JVM starts just fine if I set -ms and -mx to 120G, but if I set them to 130G, the JVM crashes on startup. The JVM…
Neil
  • 1,754
  • 2
  • 17
  • 30
17
votes
4 answers

What is the storage cost for a boxed primitive in Java?

How large, in bytes, is a boxed primitive like java.lang.Integer or java.lang.Character in Java? An int is 4 bytes, a typical pointer is also 4 byte (if not compressed by the JVM). Is the cost for an Integer (without caching) thus 4 bytes + 4 bytes…
scravy
  • 11,904
  • 14
  • 72
  • 127
17
votes
1 answer

How can I determine why the Hotspot JVM decided to re-compile already JIT:ed code a second time?

I'm trying to write a warm-up routine for a latency sensitive java application in order to optimize the first few transactions that would otherwise be slowed down by dynamic class loading and JIT (mainly). The problem I'm facing is that even though…
user268744
  • 371
  • 1
  • 8
16
votes
2 answers

Hotspot7 hsdis PrintAssembly Intel Syntax

It annoys me every time I use -XX:+PrintAssembly with Hotspot and have to read the horrible AT&T syntax. Is there a way to tell it to use the Intel syntax?
Voo
  • 29,040
  • 11
  • 82
  • 156
16
votes
3 answers

Is Method area still present in Java 8?

Prior to Java 8 we had 5 major runtime data areas: Method Area Heap JVM Stacks PC registers Native method stacks With Java 8, there is no Perm Gen, that means there is no more “java.lang.OutOfMemoryError: PermGen” which is great but I also…
Eshu
  • 499
  • 4
  • 15
16
votes
1 answer

Is there any instruction reordering done by the Hotspot JIT compiler that can be reproduced?

As we know, some JIT allows reordering for object initialization, for example, someRef = new SomeObject(); can be decomposed into below steps: objRef = allocate space for SomeObject; //step1 call constructor of SomeObject; //step2 someRef =…
user2351818
  • 557
  • 2
  • 15
16
votes
5 answers

What is the difference between -Xss and -XX:ThreadStackSize?

I just want to control the stack size for all of my threads in a Java (groovy) application. For the Hotspot Oracle VM, I know that there are two parameters doing that (-Xss and XX:ThreadStackSize). Which is the preferred one? Is there any…
user2078148
  • 591
  • 1
  • 4
  • 13
16
votes
2 answers

Java8 metaspace & heap usage

I have this code to generate class dynamically and load it import javassist.CannotCompileException; import javassist.ClassPool; public class PermGenLeak { private static final String PACKAGE_NAME = "com.jigarjoshi.permgenleak."; public…
jmj
  • 237,923
  • 42
  • 401
  • 438
16
votes
1 answer

What does Oop Maps means in Hotspot VM exactly

I read from some documents that Hotspot VM utilizes a data structure called Oop Maps to manage all OOPs in VM. My question is that when does this Oop Map data structure generated? At compile time or runtime? Any further detailed documents regarding…
Bill Randerson
  • 1,028
  • 1
  • 11
  • 29
16
votes
2 answers

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

I found the JVM flags here. Is there a more detailed explaination of what exactly they do?
ripper234
  • 222,824
  • 274
  • 634
  • 905