Duplicate :
|
|
Relates :
|
|
Relates :
|
The G1 heap can currently only shrink from the top down. In applications that allocates lots of large objects this can become a problem since G1 does not move large objects. If a large object happens to be allocated near the top of the heap, G1 will not be able to shrink the heap even if there is plenty of free space below the large object. Old regions that G1 gives a low priority to collect will also stop the heap from shrinking in a similar manner. As long as there are old regions near the top of the heap, G1 can not shrink the heap. One way to lower the risk of allocating large objects and old regions near the top of the heap is to sort the free list and make sure that we always try to claim these regions near the bottom of the heap.
|