How to analyze the behavior of Dalvik GC?

I am developing an application on Android. This is a long application that continuously processes sensor data. During application startup, I see many GC messages in logcat; about once per second.

This is most likely due to the creation of objects and immediate deletion in a loop.

How to find which objects are created and released immediately?

All java heap analysis tools I tried (*) are concerned about the number and size of objects in the heap. While they are useful, I'm more interested in finding a site where temporary objects with a short life span are created the most.

(*) I tried jcatand Eclipse MAT. I could not get hatto work with a bunch of Android databases; he complained about an unsupported version of the dump file.

+5
source share
2 answers

How to find which objects are created and released immediately?

Step # 1: Temporarily change your code (or create a scrap project with the corresponding parts of your code), where you can click a button or something that needs to be done exactly once through the sensor processing logic.

Step # 2: Log in to DDMS (standalone or Eclipse perspective).

Step # 3: Select your emulator, then click on the "Distribution Tracking" tab

№4: , №1, " " " DDMS".

№4: , , " " " DDMS".

, . , "", , GC.

, startAllocCounting() android.os.Debug , " ". , , , .

, FWIW, DDMS .

+4

All Articles