Understanding Java Inflation

Many times, analyzing reflection based applications, you can verify a strange behavior: many FullGC caused by Perm Gen:

This is not simple to understand, because you're expecting that Perm Gen is somewhat stable memory space after application startup apart strange classloading leaks.

Perm Gen normally is used to store class information and static elements, so, after application class loading, nothing more should be loaded in it.

Instead, sometimes, you can experience a continuos Perm Gen growth:

Normally this is related to JVM reflection optimization known as "Inflation".

Reflection isn't a performing method invocation mechanism, but many frameworks are heavily based on it.

To optimize it, JVM use 2 different approaches:

  • initially, if invocation code is executed many times, JIT transform it in native code
  • then, if method is accessed again and again JVM creates an accessor object to reach it directly by bytecode (this is known as inflation)

To verify that you Perm Gen behavior is related to Inflation, you can use SpyGlass Garbage Collector Analyzer and check New Classes tab:

Inflation

if you find that many new classes are created and you're not in application startup then you have a good chance that you're experiencing inflation.

Again you can check at JIT activity: if JIT activity is low, when you have a lot of new classes loaded probably you're experiencing Inflation:

Java Inflation

 

i.e. if new classes are application classes, then you should see a lot of JIT optimizations related to this new code.

 

Ti informiamo che, per migliorare la tua esperienza di navigazione su questo sito, sono utilizzati cookie tecnici e cookie di terze parti e non cookie di profilazione.
Alla pagina privacy avere maggiori dettagli ai sensi dell'art. 13 del Codice della privacy.
Cliccando su 'Accetto' i cookie saranno attivati Accetto