Skip to content

Commit

Permalink
Keep maxHeap in field.
Browse files Browse the repository at this point in the history
  • Loading branch information
henningandersen committed Jul 7, 2020
1 parent 66d642d commit 3eacf32
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -386,6 +386,7 @@ static class G1OverLimitStrategy implements OverLimitStrategy {

private long blackHole;
private final Object lock = new Object();
private final long maxHeap;

G1OverLimitStrategy(JvmInfo jvmInfo, LongSupplier currentMemoryUsageSupplier,
LongSupplier timeSupplier, long minimumInterval) {
Expand All @@ -400,6 +401,7 @@ static class G1OverLimitStrategy implements OverLimitStrategy {
} else {
this.g1RegionSize = g1RegionSize;
}
maxHeap = jvmInfo.getMem().getHeapMax().getBytes();
}

static long fallbackRegionSize(JvmInfo jvmInfo) {
Expand All @@ -422,7 +424,6 @@ static long fallbackRegionSize(JvmInfo jvmInfo) {

@Override
public MemoryUsage overLimit(MemoryUsage memoryUsed) {
long maxHeap = JvmInfo.jvmInfo().getMem().getHeapMax().getBytes();
boolean leader;
synchronized (lock) {
leader = timeSupplier.getAsLong() >= lastCheckTime + minimumInterval;
Expand Down

0 comments on commit 3eacf32

Please sign in to comment.