我有一個在大多數手機(如Nexus **)上運行OK的應用程序:內存使用率永遠不會超過24MB。 但在我的索尼愛立信Xperia Arc上運行幾天後,它使用了超過70MB的RAM(根據設置 - >應用程序 - >運行服務)。Android應用程序在某些手機上使用的內存大於最大堆大小
Runtime.getRuntime()。maxMemory()表示我的手機的最大堆大小僅爲32MB。
有什麼方法可以找出我的應用在這款手機上發生了什麼?
下面是這個應用程序的ADB meminfo中:
C:\>adb -d shell dumpsys meminfo 4606
Applications Memory Usage (kB):
Uptime: 409334045 Realtime: 585217200
** MEMINFO in pid 4606 [com.*****************] **
native dalvik other total
size: 60796 10695 N/A 71491
allocated: 54057 6091 N/A 60148
free: 6706 4604 N/A 11310
(Pss): 56549 1129 8385 66063
(shared dirty): 2128 1304 4964 8396
(priv dirty): 56496 892 8156 65544
Objects
Views: 0 ViewRoots: 0
AppContexts: 0 Activities: 0
Assets: 3 AssetManagers: 3
Local Binders: 5 Proxy Binders: 14
Death Recipients: 222
OpenSSL Sockets: 2
SQL
heap: 425 MEMORY_USED: 425
PAGECACHE_OVERFLOW: 81 MALLOC_SIZE: 50
DATABASES
pgsz dbsz Lookaside(b) Dbname
1 54 223 *.db
1 27 198 **.db
1 5 24 ***.db
1 11 56 ****.db
C:\>
半天后,它達到了85MB,下一次我檢查時,它被系統殺死(RAM使用量下降到20MB,PID改變)。 –
我確實收到了市場評論,稱這款應用在手機上超過150MB。 –