BinaryShrub
BinaryShrub

Reputation: 346

Dumpsys meminfo: kB or KB?

Is the memory returned by adb shell dumsys meminfo in kB or KB?

where:

kB = 1000 bytes    
KB = 1024 bytes

Upvotes: 5

Views: 2369

Answers (1)

Jeffrey Blattman
Jeffrey Blattman

Reputation: 22637

It's KB (1024 bytes), or kibibytes (KiB), contrary to the kB notation in their printfs which is supposed to mean 1000 bytes as you noted.

Here's how I know. On my Linux box, if I do free -b,

             total       used       free     shared    buffers     cached
Mem:    67459153920 60865880064 6593273856  307834880 1373028352 40107618304

So look at the total value of 67459153920. That's in bytes (-b). Now if I look at meminfo,

MemTotal:       65878080 kB

and 67459153920 / 1024 = 65878080, so that value is in KB or aka KiB (1024 bytes).

https://en.wikipedia.org/wiki/Kilobyte

Note that I tested this on my Linux desktop because Android Linux doesn't happen to include the free command, but dumpsys meminfo is just reporting the results of cat /proc/meminfo which is implemented at the Linux kernel level of Android fs/proc/meminfo.c.

Upvotes: 9

Related Questions