G1 determines the number of young gen regions using a prediction based on survivor ratio of the n'th allocated region.
I.e. when determining whether the next collection can meet the pause time to collect the n'th allocated region, it uses a prediction of the survival rate of previous n'th allocated regions.
If G1 never before encountered a young gen size (e.g. for a young gen size n+1, where n is the maximum young gen size encountered so far), it linearly interpolates from the prediction of the last known young gen region n to n+1.
This causes issues sometimes overestimates the amount of young gen regions it can expand to, as that last data point might not represent the n+1'th region, or it might be based on very little samples.
Improve the prediction in this case, trying to avoid being too greedy with the number of young gen regions.
Some potential solutions
- cap the amount of young gen expansion by x% of the previous young gen so that extreme cases can not occur
- use more samples (like from last five regions n-4...n) to determine the n+x'th survivor rate.
- other solutions
I.e. when determining whether the next collection can meet the pause time to collect the n'th allocated region, it uses a prediction of the survival rate of previous n'th allocated regions.
If G1 never before encountered a young gen size (e.g. for a young gen size n+1, where n is the maximum young gen size encountered so far), it linearly interpolates from the prediction of the last known young gen region n to n+1.
This causes issues sometimes overestimates the amount of young gen regions it can expand to, as that last data point might not represent the n+1'th region, or it might be based on very little samples.
Improve the prediction in this case, trying to avoid being too greedy with the number of young gen regions.
Some potential solutions
- cap the amount of young gen expansion by x% of the previous young gen so that extreme cases can not occur
- use more samples (like from last five regions n-4...n) to determine the n+x'th survivor rate.
- other solutions