I was running my app on Nexus S, the per-app memory limit on which is 32M bytes.
I ran the command to check the memory usage of the app:
adb -d shell dumpsys meminfo com.mycomp.myapp
Applications Memory Usage (kB):
Uptime: 1128469 Realtime: 1128466
** MEMINFO in pid 841 [com.mycomp.myapp] **
native dalvik other total
size: 29148 9415 N/A 38563
allocated: 20259 6273 N/A 26532
free: 379 3142 N/A 3521
(Pss): 9253 2049 25338 36640
(shared dirty): 1984 1520 7836 11340
(priv dirty): 9180 960 16212 26352
Objects
Views: 0 ViewRoots: 0
AppContexts: 0 Activities: 0
Assets: 24 AssetManagers: 24
Local Binders: 11 Proxy Binders: 23
Death Recipients: 1
OpenSSL Sockets: 0
SQL
heap: 173 MEMORY_USED: 173
PAGECACHE_OVERFLOW: 28 MALLOC_SIZE: 50
DATABASES
pgsz dbsz Lookaside(b) Dbname
1 14 61 webview.db
1 8 53 webviewCache.db
From the memory report above, my app already used 38563K memory, which has already exceeded 32M VM budget. But why hasn’t the app crashed yet?
Look at the ‘allocated’ row, it is under the 32M limit.