Total Count column
Total Count is defined as the total object count (see Android Studio source), specifically:
new AttributeColumn<>(
"Total Count",
() -> new SimpleColumnRenderer<ClassifierSet>(
value -> Integer.toString(value.getAdapter().getTotalObjectCount()),
value -> null,
SwingConstants.RIGHT),
This getTotalObjectCount() is defined as:
public int getTotalObjectCount() {
return mySnapshotObjectCount + myDeltaAllocations - myDeltaDeallocations;
}
Incrementing methods
The mySnapshotObjectCount value is incremented inside addSnapshotInstanceObject, which has the helpful comment:
Add an instance to the baseline snapshot and update the accounting of
the "total" values.
The myDeltaAllocations and myDeltaDeallocations values are incremented inside addDeltaInstanceInformation:
if (isAllocation) {
myDeltaAllocations++;
}
else {
myDeltaDeallocations++;
}
This is called inside partition, which contains the helpful comment:
Partitions InstanceObjects in snapshotInstances and myDeltaInstances according to the current ClassifierSet strategy. This will consume the instances from the input.
This snapshotInstance is the same one used to increment mySnapshotInstanceObjectCount, thus showing that all 3 values are very closely linked, are created when a partition (snapshot) is made, and all factor into the Total Count.
Final formula
So, the final answer is:
Total Count = Snapshot objects + New allocations - New deallocations
- Snapshot objects = number of object instances allocated before the snapshot.
- New allocations = number of allocations during snapshot.
- New deallocations = number of deallocations during snapshot.
This definition of the equation matches what Axifive stated in another answer, and the linked video.