1

I have sample app with starting RSS size of 600MB when using serial GC. Once I use G1 RSS memory after bootstrap increases to 800Mb.

Does anybody know how I can profile that increase and whenever there any G1 tuning options to improve memory footprint?

Ravindra babu
  • 37,698
  • 11
  • 250
  • 211
Petro Semeniuk
  • 6,970
  • 10
  • 42
  • 65

1 Answers1

3

If you really really you care about memory footprint above all else, don't use G1. It's a complex GC with auxiliary data structures and it avoids doing full GCs by only collecting the old gen piece-meal. It also has a pause time goal by default that causes it to prefer growing the heap rather than missing its pause time goal.

Stick to serial gc or the throughput parallel collector.

You can try the following though: -XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=20 -XX:InitiatingHeapOccupancyPercent=30, that should tell G1 to more aggressively yield back memory to the OS and to start collecting the old gen sooner.

the8472
  • 40,999
  • 5
  • 70
  • 122
  • Thanks. I already have custom XX:MaxHeapFreeRatio, XX:MinHeapFreeRatio and XX:InitiatingHeapOccupancyPercent so I guess 800Mb is the best memory footprint I could get. – Petro Semeniuk Jun 29 '15 at 10:31
  • next time mention something like that – the8472 Jun 29 '15 at 18:15
  • ;-) Question is still valid since I'm switching from serial to g1, all else being equal. – Petro Semeniuk Jun 29 '15 at 20:25
  • You have done the right thing. I have seen excellent results with G1GC. Have a look at : http://stackoverflow.com/questions/574021/reducing-jvm-pause-time-1-second-using-useconcmarksweepgc/34186346#34186346 and – Ravindra babu Dec 14 '15 at 05:28