I want to collect the number of allocated objects (java object) in each method of an Activity in an Android application. For example,
void onCreate(...) {
...
...
ObjectType1 obj1 = new objectType1();
ObjectType1 obj2 = new objectType1();
}
In the above code snippet, two objects of type ObjectType1
was allocated. I want to get this allocation count information and collect it into a CSV file.
I am familiar with Android Profiler and can get the Allocation count when arranged by callstack.
My question is, is it possible to dump that memory allocation data and parse them into a suitable format somehow?
N.B.: I am only interested in Java objects allocated from the application side.