0

We have an an enterprise application deployed in wildfly 8.2 with min & max heap set to 1.5 GB. One of the actions is causing too much objects to be loaded into the heap. Although the object is dereferenced after the action, the jvm heap usage is not coming down.

But, if I manually trigger GC externally(using jcmd), I am seeing a huge dip in the heap usage. Why is normal GC not reducing the memory as much as GC.run?

JVM settings

-Xms1536m -Xmx1536m -XX:MaxMetaspaceSize=512m -XX:ReservedCodeCacheSize=128M -server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Djsse.enableSNIExtension=false -Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000

Liju Thomas
  • 1,054
  • 5
  • 18
  • 25
Sandeep
  • 199
  • 3
  • 11

1 Answers1

2

What you trigger from the outside is Major/Full GC, which is not triggered automatically unless absolutely necessary. The JVM tries to make a living with garbage in the Old Generation for as long as it can, in order to avoid the infamous GC pause.

Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436
  • 1
    Note the OP is reducing how often a Full GC is triggered by the GDC, which is indirectly contributing to this behaviour. +1 – Peter Lawrey Oct 04 '16 at 10:51
  • Well noted... but does it apply to EJB, too? They should be pooled and "cleaned up" after a request. I thought DGC was more of an issue with raw RMI usage. – Marko Topolnik Oct 04 '16 at 10:52
  • 1
    gdc is for rmi but it ensures full GCs occur regularly no matter what you might be doing. – Peter Lawrey Oct 04 '16 at 11:15