Does G1 GC have a max size of region or max amount of region?

前端 未结 1 1303
小鲜肉
小鲜肉 2020-12-20 22:23

when i studied G1 GC, I found this article: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html. In that article, there is something says as follow:

相关标签:
1条回答
  • 2020-12-20 23:07

    From HotSpot JVM sources:

      // Minimum region size; we won't go lower than that.
      // We might want to decrease this in the future, to deal with small
      // heaps a bit more efficiently.
      static const size_t MIN_REGION_SIZE = 1024 * 1024;
    
      // Maximum region size; we don't go higher than that. There's a good
      // reason for having an upper bound. We don't want regions to get too
      // large, otherwise cleanup's effectiveness would decrease as there
      // will be fewer opportunities to find totally empty regions after
      // marking.
      static const size_t MAX_REGION_SIZE = 32 * 1024 * 1024;
    
      // The automatic region size calculation will try to have around this
      // many regions in the heap (based on the min heap size).
      static const size_t TARGET_REGION_NUMBER = 2048;
    
    • MIN_REGION_SIZE (1MB) and MAX_REGION_SIZE (32MB) are hard limits;
    • TARGET_REGION_NUMBER is just a hint that is used to calculate default region size if it is not specified among JVM options. The actual number may exceed this value.
    0 讨论(0)
提交回复
热议问题