Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android, track Memory by DDMS, "Get Allocations" doesn't do anything

As the title of the question said. Steps I did:

  1. click on Update heap
  2. In Allocation Tracker tab, click "Start Tracking"
  3. Click "Get Allocations"

In the console, I saw red messages saying:

[2013-12-29 13:56:40 - ddm-heap] *** Received REAL`

What happened? am I missing anything?

Thanks

like image 742
EyeQ Tech Avatar asked Dec 29 '13 03:12

EyeQ Tech


2 Answers

It needs to be done in Android Studio. (Thanks to the Project Member who said this on this bug report: https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=74059)

You can see that the icons even have the same name as the icons in DDMS (which is confusing)! But the Allocation Tracker in DDMS does not work, and the one in Android Studio "Android Monitor" does.

P.S. In the screenshots I was using Android Studio 2.3 and Android Device Monitor version 25.2.2.

Wrong (Does not work):

DDMS Monitor (does not work)

Right (works):

Android Monitor in Android Studio

The results will show up in a window next to your source code like this:

enter image description here

For more info:

https://developer.android.com/studio/profile/am-memory.html https://developer.android.com/studio/profile/am-allocation.html

like image 176
Rock Lee Avatar answered Oct 26 '22 15:10

Rock Lee


Well, REAL is a REcent ALlocation. Based on the source code, logging an error is the very first line of handleREAL(). Just an assumption - this should be Log.d() instead of Log.e(), but I cannot say for sure.

And yes, "Get Allocations" for me works not every time I click it. The resulting log cannot be exported, and disappears as soon as the app on device finishes. Sadly, not a very convenient tracing tool...

like image 21
Over17 Avatar answered Oct 26 '22 16:10

Over17