-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix distribute free regions (#74916)
As it turns out, distribute_free_regions does not do a very good job distributing free regions if there are fewer than the budget demands. There are several reasons: - there is a bug in the adjustment_per_heap computation that causes the value to be too large - that is because dividing a negative number already rounds towards zero, and hence towards positive infinity, thus adding (n_heaps-1) before dividing is wrong. - if the overall budget is not a multiple of the number of heaps, trying to fill each heap to the budget will allow heaps with higher numbers to have significant shortfalls. - if the budget is not enough to cover the higher generations, heaps with high budget in these generations may cause other heaps to be unable to even cover their gen 0 budget. The fix addresses these shortcomings: - once we cover the budget for a generation, this is considered the minimum, higher generation budgets on other heaps are not allowed to reduce it below that minimum. So lower generations take priority, we are essentially trying to delay running out of budget as long as possible. - we use a better algorithm to distribute a budget shortfall or surplus over all heaps. there is still a slight tendency for the last heap to receive fewer regions in the case of a shortfall.
- Loading branch information
1 parent
9e2a718
commit ed10bc0
Showing
1 changed file
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters