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
24
votes
2 answers

What is Klass & KlassKlass

What is Klass & KlassKlass in JVM Hotspot Implementation? As far as I understood from the article Presenting the Perm Generation, Klass is the internal representation of a Java class (let's say A) & it will hold the basic information about the…
Vivek
  • 1,640
  • 1
  • 17
  • 34
23
votes
4 answers

Why HotSpot will optimize the following using hoisting?

In the "Effective Java", the author mentioned that while (!done) i++; can be optimized by HotSpot into if (!done) { while (true) i++; } I am very confused about it. The variable done is usually not a const, why can compiler optimize that…
user705414
  • 20,472
  • 39
  • 112
  • 155
23
votes
1 answer

Why using parallel streams in static initializer leads to not stable deadlock

CAUTION: it is not a duplicate, please read topic сarefully https://stackoverflow.com/users/3448419/apangin quote: The real question is why the code sometimes works when it should not. The issue reproduces even without lambdas. This makes me…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
22
votes
1 answer

What does CompileThreshold, Tier2CompileThreshold, Tier3CompileThreshold and Tier4CompileThreshold control?

HotSpot's tiered compilation uses the interpreter until a threshold of invocations (for methods) or iterations (for loops) triggers a client compilation with self-profiling. The client compilation is used until another threshold of invocations or…
Nathan
  • 8,093
  • 8
  • 50
  • 76
21
votes
3 answers

'Eden space' name origin in Garbage Collection

In Garbage Collection terminology, why is it called 'Eden Space'? Just like that. I'm still getting familiar with the terminology and I cannot understand why it has such name.
Ytsejammer
  • 1,384
  • 2
  • 13
  • 25
21
votes
4 answers

Encourage the JVM to GC rather than grow the heap?

(Note that when I say "JVM", I really mean "Hotspot", and I'm running the latest Java 1.6 update.) Example situation: My JVM is running with -Xmx set to 1gb. Currently, the heap has 500mb allocated, of which 450mb is used. The program needs to…
Electrons_Ahoy
  • 36,743
  • 36
  • 104
  • 127
21
votes
2 answers

How can I write code to hint to the JVM to use vector operations?

Somewhat related question, and a year old: Do any JVM's JIT compilers generate code that uses vectorized floating point instructions? Preface: I am trying to do this in pure java (no JNI to C++, no GPGPU work, etc...). I have profiled and the bulk…
user450775
  • 467
  • 1
  • 5
  • 14
20
votes
4 answers

Method Area and PermGen

I was trying to understand the memory structure of HotSpot JVM and got confused with the two terms "Method Area" and "PermGen" space. The docs I referred to say that Method Area contains the definition of classes and methods including the byte code.…
Ratheesh P Kumar
  • 233
  • 1
  • 2
  • 10
20
votes
2 answers

Is Java 7 at least as stable as Java 6?

I remember when Java 7 was initially released, there were many suggestions not to use it for anything as there were some bugs in compiler optimizations. This was apparently not merely hypothetical. I haven't followed the situation closely since…
Michael McGowan
  • 6,528
  • 8
  • 42
  • 70
20
votes
3 answers

Java 8 String deduplication vs. String.intern()

I am reading about the feature in Java 8 update 20 for String deduplication (more info) but I am not sure if this basically makes String.intern() obsolete. I know that this JVM feature needs the G1 garbage collector, which might not be an option…
Hilikus
  • 9,954
  • 14
  • 65
  • 118
20
votes
3 answers

Where are instance variables of an Object stored in the JVM?

Is an instance variable of an object in Java stored on the stack or method area of the JVM? Also, do we have different instance variable for multiple threads? If it is stored in method area how is instance variable different from static variable…
saurabh goyal
  • 1,754
  • 8
  • 35
  • 45
20
votes
6 answers

JVM -XX:+StringCache argument?

I was recently reading about all the JVM arguments available in JRE 6 [Java VM Options] and saw this : -XX:+StringCache : Enables caching of commonly allocated strings. Now I was always under the impression that Java kept a pool of interned…
Gandalf
  • 9,648
  • 8
  • 53
  • 88
19
votes
3 answers

Setting -XX:MaxRam

According to this link, there is an option to set MaxRamSize manually to restrict the JVM to not use memory beyond this. But I have not seen any documentation of the same. I've never known this. Is there anything like this or anything similar? PS. I…
Vipin Menon
  • 2,892
  • 4
  • 20
  • 35
19
votes
1 answer

When can Hotspot allocate objects on the stack?

Since somewhere around Java 6, the Hotspot JVM can do escape analysis and allocate non-escaping objects on the stack instead of on the garbage collected heap. This results in a speedup of the generated code and reduces pressure on the garbage…
JanKanis
  • 6,346
  • 5
  • 38
  • 42
19
votes
1 answer

How to disable minidump (mdmp) files generation with Java Hotspot JVM on Windows

Currently I have a deployed executable jar file that creates large (7+ Gb) minidump files when it crashes. I would like to have a text representation of what caused the crash, not a binary file of the JVM state. I've tried using the information…
Lucas
  • 2,514
  • 4
  • 27
  • 37
1 2
3
46 47