1

Recently we added g1-gc algorithm for our process, but we found that our process kept taking memory from os which it is not using, In previous release we didn't have this issue because we were using one explicit GC thread which were doing explicit garbage collection after threshold time duration . So our problem is can we do this with g1-gc with some tuning flag

  • How do you determine that the process is not using this memory? – Holger Jul 03 '18 at 11:31
  • @Holger when we decreased xms xmx size for java , for same scenario we found that total memory taken by process never crossed beyond a lower value, also the total memory used by java is very less based on heap dump. – itsOkToAskStupidQus Jul 03 '18 at 20:26
  • This indicates that the program could run without it, not that it is not using it when it is available. Generally, this is a trade off between memory consumption and CPU consumption. Reducing the heap is already one way to tell it to use more CPU (more frequent GC cycles) to use less memory. I suppose, you want it to try use less heap, but be open to use more heap when unavoidable. So perhaps, [`-XX:InitiatingHeapOccupancyPercent` and `-XX:G1MixedGCLiveThresholdPercent`](https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc_tuning.html#sthref54) are the right options for you – Holger Jul 04 '18 at 06:02
  • If your goal is to conserve memory take a look at https://stackoverflow.com/a/30464183/1362755 that said, g1 currently is not-time triggered, only allocation-triggered. – the8472 Jul 04 '18 at 17:37
  • Possible duplicate of [Does GC release back memory to OS?](https://stackoverflow.com/questions/30458195/does-gc-release-back-memory-to-os) – the8472 Jul 04 '18 at 17:37

0 Answers0