3

I am using G1GC.

Is there a jvm argument I can pass to jvm so I get a gc log every time Humongous allocation happens?

Erben Mo
  • 3,528
  • 3
  • 19
  • 32
  • How big is **Humongous** – Scary Wombat Oct 25 '16 at 06:55
  • I don't get your question. How many lines of code do you have that would instantiate *humongous* arrays or objects that would require *humongous* amounts of memory? In other words: what is the problem you are trying to solve? – GhostCat Oct 25 '16 at 07:04
  • 3
    I am talking about G1GC humongous allocation. – Erben Mo Oct 25 '16 at 07:08
  • Have a look - https://plumbr.eu/handbook/gc-tuning-in-practice/other-examples/humongous-allocations – kjsebastian Oct 25 '16 at 07:14
  • @conscells The log in that blog only get printed if the total old gen size reaches the threshold. It actually takes a couple hundred humongous allocation for the total old gen size to breach the threshold. What I want is a log that get printed every time a humongous allocation happens – Erben Mo Oct 25 '16 at 07:18
  • In that case you might need a tool like jvisualvm or Yourkit. I'm not sure if they have this feature – kjsebastian Oct 25 '16 at 07:32
  • jmc can record allocations outside TLAB, which generally tend to be large allocatons, yourkit can filter allocation profiling by object size. – the8472 Oct 25 '16 at 07:41

1 Answers1

4
-XX:+UnlockDiagnosticVMOptions -XX:+G1PrintHeapRegions

On every humongous allocation this will emit G1HR ALLOC(StartsH) or G1HR ALLOC(SingleH) line. Caution: this option will cause much more debug information printed to GC log or console.

apangin
  • 92,924
  • 10
  • 193
  • 247