8

according to a google io video about getting to know how much memory you app takes , you can use procrank and read the USS value of it.

i've tried it out on emulators (no matter which version i use - from 2.3.x to 4.1) and it works well , but running on an actual device , it didn't work (tested on galaxy s3 with android 4.0.4) . it's as if the command doesn't exist .

how could it be ? is there an alternative to get this USS value?

Goo
  • 1,318
  • 1
  • 13
  • 31
android developer
  • 114,585
  • 152
  • 739
  • 1,270

4 Answers4

4

You can use dumpsys command

Steps:

  1. issue command line: dumpsys meminfo packageName
  2. The Private Dirty column is you wanted.
biegleux
  • 13,179
  • 11
  • 45
  • 52
Nigel Ding
  • 41
  • 2
2

U can also use

adb shell dumpsys meminfo

or

adb shell dumpsys meminfo  + pid

command

Hugo
  • 1,303
  • 14
  • 16
  • are you sure ? is it exactly the same ? i mean , is it really the value which says : "the amount of bytes that will be freed when the process of this app will be killed" ? – android developer Apr 28 '13 at 05:44
1

adb shell dumpsys meminfo [pid] (Private Dirty + Private Clean)

is same as

procrank (USS)

neel
  • 184
  • 5
  • Can you show some reference that says that it's the same? – android developer Feb 25 '15 at 15:54
  • I checked the actual output of both the commands to conclude that. Also some scattered references on web [here](http://soumya.co.in/wp/?p=74) `The Uss refers to the private pages of a process, which can be further exclusively divided into PrCl(clean ones) and PrDi(dirty ones)` and [here](http://roylee17.blogspot.kr/2010/06/memory-usage-estimation-on-android.html) `The important details are the memory used by USS (Private Dirty + Private Clean) and PSS total` – neel Feb 26 '15 at 05:33
  • Another reference can be found in this [stackexchange-question] (https://unix.stackexchange.com/questions/33381/getting-information-about-a-process-memory-usage-from-proc-pid-smaps) `USS isn't reported in smaps, but indeed, it is the sum of private mappings`. – neel Feb 26 '15 at 05:53
-1

procrank and dumpsys meminfo is not the same command, because procrank can show more thread which is killed by accident.

First you shell get procrank, procmem, libpagemap.so from Google

Then do push like :

adb push procrank /system/xbin 
adb push procmem /system/xbin 
adb push libpagemap.so /system/lib

Last :

adb shell chmod 6755 /system/xbin/procrank 
adb shell chmod 6755 /system/xbin/procmem 
adb shell chmod 6755 /system/lib/libpagemap.so
Alex
  • 937
  • 3
  • 20
  • 44