0

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?

Davide Piras
  • 43,984
  • 10
  • 98
  • 147
Kai
  • 3,775
  • 10
  • 39
  • 54
  • 1
    Have you read http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android ? – Jack Nov 22 '11 at 22:37
  • Yes, I read this article before. But I am not sure which row to look at to watch for OutOfMemoryError. – Kai Nov 22 '11 at 22:50
  • As Derek said, I think it will be the 'allocated' row. If you add allocated and free, that gives 30053, which is < 32Mb. – Jack Nov 22 '11 at 22:57
  • So, should I look at 'allocated' only or 'allocated' + 'free'? – Kai Nov 22 '11 at 23:13

1 Answers1

2

Look at the 'allocated' row, it is under the 32M limit.

RealCasually
  • 3,593
  • 3
  • 27
  • 34