Search code examples
javagarbage-collectionjvmjvm-hotspotconcurrent-mark-sweep

How to cause a very high heap fragmentation in Java 8 HotSpot using CMS GC


I am studying Java8 HotSpot heap fragmentation (on CMS), and I'm struggling to write some code that produces high fragmentation. I've been trying with very large objects without success.

Could someone post a code that creates a very high heap fragmentation (that reaches a promotion failure), so I could study it ?

Thanks


Solution

  • Take a look at HeapFragger by Gil Tene from Azul systems.

    It is tool build to demonstrate flaws in HotSpot JVM garbage collection.