简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM