Fix calculation of PoolArena metrics after introducing a regression in 89da788fd2

This commit is contained in:
Norman Maurer 2016-03-17 10:06:37 +01:00
parent 0a87c98993
commit 36f3999632

View File

@ -470,7 +470,7 @@ abstract class PoolArena<T> implements PoolArenaMetric {
public long numDeallocations() {
final long deallocs;
synchronized (this) {
deallocs = deallocationsTiny + deallocationsSmall + allocationsNormal;
deallocs = deallocationsTiny + deallocationsSmall + deallocationsNormal;
}
return deallocs + deallocationsHuge.value();
}
@ -502,11 +502,11 @@ abstract class PoolArena<T> implements PoolArenaMetric {
@Override
public long numActiveAllocations() {
long val;
long val = allocationsTiny.value() + allocationsSmall.value() + allocationsHuge.value()
- deallocationsHuge.value();
synchronized (this) {
val = allocationsNormal - deallocationsTiny - deallocationsSmall - allocationsNormal;
val += allocationsNormal - (deallocationsTiny + deallocationsSmall + deallocationsNormal);
}
val -= deallocationsHuge.value();
return val >= 0 ? val : 0;
}