Reputation: 1044
I'm unable to find a description of this metric anywhere in the Android developer documentation. Here is a link to what I've most recently looked at: https://developer.android.com/studio/profile/memory-profiler
Here's what I think it is: the number of objects in the heap that have not been deallocated.
Please, if possible, provide a credible resource that supports your reasoning (e.g. a Google I/0 talk on Youtube with a minute-mark or some Android documentation).
EDIT: Here is a screenshot that includes the metric.
Upvotes: 4
Views: 931
Reputation: 7989
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;
}
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
insnapshotInstances
andmyDeltaInstances
according to the currentClassifierSet
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.
So, the final answer is:
Total Count = Snapshot objects + New allocations - New deallocations
This definition of the equation matches what Axifive stated in another answer, and the linked video.
Upvotes: 2
Reputation: 1151
Yes this is the total number of instance, that has allocated before the selected period + memory allocation for the selected period (or as you says: number of objects(instances) in the heap that haven't been deallocated for the selected period)
You can see this here
On the Instance View, it can be seen that three int
arrays were allocated at 1m, but not deallocated (for the selected period).
Upvotes: 0
Reputation: 23
Here's what I think it is: the number of objects in the heap that have not been deallocated.
You are right with your thinking but I cannot serve you with a public thread for that.
Upvotes: 0