Most Popular Posts

27/08/2013

Garbage Collection Options and Functions


Garbage collection options:

In addition to one of the previous posts regarding memory management options in various JVMs, now it is time to present some options for the GC (Garbage Collector)

Select specific collector:
  • -XX:+UseSerialGC
  • -XX:+UseParallelGC
  • -XX:+UseParallelOldGC (combine with -XX:+UseParallelGC)
  • -XX:+UseConcMarkSweepGC
  • -Xnoclassgc is to disable garbage collection for permanent generation

Tune the Parallel GC:

  • -XX:ParallelGCThreads=n - limit parallel threads by 'n'
  • -XX:MaxGCPauseMilis=n - limit pause in miliseconds
  • -XX:GCTimeRatio=n - throughput (percentage of CPU time spent on application
Increase debug level:

  • -XX:+PrintGC - get basic information
  • -XX:+PrintGCDetails - get verbose information
  • -XX:+PrintGCTimeStamps - add timestamps
  • -XX:+HeapDumpOnOutOfMemoryError very useful :)

No comments:

Post a Comment