Grzegorz Mirek

Why Server If It’s Not a Server?

Have you ever wondered why when you type java -version, you usually get something like that: java version “1.8.0_131” Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)   Why Server VM? For JVM, some machines are considered to be “client-class” and some are “server-class”. If the given machine…

Read more...

Garbage Collectors Overview

The current version of HotSpot JVM includes three types of garbage collectors: – Serial Collector – Parallel Collector – The Mostly Concurrent Collectors   All of them are generational ones, meaning that they take advantage of the way the heap is divided.   There are three main operations which garbage collector is responsible for: –…

Read more...

Yet Another Post About Java Heap Space

Generational Garbage Collectors JVM heap is divided into two different Generations. One is called Young and the second one is the Old (sometimes referred to as Tenured). The Young Generation is further separated into two main logical sections: Eden and Survivor spaces. There are also Virtual spaces for both Young and the Old Generations which…

Read more...

What Causes OutOfMemoryError?

OutOfMemoryError might be thrown when one of the following circumstances occurs: JVM has run out of native memory Java heap is out of memory PermGen or Metaspace has run out of memory JVM spent too much time trying to collect the garbage The root cause of OutOfMemoryError can be usually deducted from the error message. Let’s…

Read more...

Shallow, Retained and Deep Size

If you ever worked with heap analysis, you might have encountered terms such as shallow, retained and deep size of an object. It doesn’t really matter if we’re talking about analyzing JVM heap dump with VisualVM or JavaScript heap snapshot with Chrome DevTools – the terms are the same. The difference between shallow, retained and…

Read more...

When Application Threads Can Be Stopped: Safepoints

There are two logical groups of threads in Java application: application threads performing application logic threads performing GC   When performing operations such as heap compaction, GC threads move some objects around and those objects cannot be used by any of the application thread, because their physical location may change. This leads to so called…

Read more...

PermGen and Metaspace

PermGen is an abbreviation for Permanent Generation and it’s a special heap space which is separate from the main Java heap where JVM keeps track of metadata of the classes which have been loaded. In Java 8 PermGen has been renamed to Metaspace – with some subtle differences. From our perspective, it is important to…

Read more...

Deoptimization

When looking at the output of -XX:+PrintCompilation JVM flag, it’s easy to spot some entries with “made not entrant” and “made zombie”. This indicates so called deoptimization. What it basically means is that the code which was previously compiled, has to be backed out.   Not entrant code Code can be made not entrant in…

Read more...

Tiered Compilation

Even though there are only two basic compilers (+ interpreter) in Java, there are five levels of executions, because the client (C1) compiler has three different levels of compilation. The server compiler (C2) has only one.   Level 0 – interpreted code Level 1 – simple C1 compiled code (with no profiling) Level 2 –…

Read more...

What’s So Hot in HotSpot?

HotSpot JVM is the primary reference Java Virtual Machine implementation. The name comes from the approach it takes toward compiling the code. Hot spot is the code which is executed frequently. The more frequently code is executed, the hotter it becomes. If HotSpot JVM finds that kind of code, it will compile it to make…

Read more...