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 5c02397689
commit 8d499a2419

View File

@ -468,7 +468,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();
}
@ -500,11 +500,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;
}