What triggers a full garbage collection in Java?

前端 未结 2 1905
深忆病人
深忆病人 2020-12-02 19:02

I\'m wondering what are the exact situations that trigger Full Garbage Collection in Java.

The obvious ones are:

  • Running out of old gen
  • Runnin
相关标签:
2条回答
  • 2020-12-02 19:38

    This greatly depends on your jvm options and the jvm that you at using.

    For this reason, I recommend that you look at the book "Java Performance" bý John and Hunt.

    0 讨论(0)
  • 2020-12-02 19:44

    I've observed one more situation that triggers a full GC in Java Hotspot VM 1.6 64bit on Ubuntu, using Concurrent Mark-Sweep:

    If -XX:PermSize value does not equal to -XX:MaxPermSize (e.g. is smaller), an occasional Full GC happens when java needs to expand the PermGen (even though it does not need to allocate more memory than MaxPermSize). So setting -XX:PermSize and -XX:MaxPermSize to be the same seems like a good idea.

    0 讨论(0)
提交回复
热议问题