我认为我的Android应用程序存在内存泄漏问题。虽然我不完全确定这是否是问题所在。
有时候,当打开应用程序时,它会崩溃,并且logcat显示一个“out of memory”异常,试图加载位图图像。
崩溃后,我重新打开应用程序,它可以正常工作。Logcat显示了许多“gc”,并且每隔一段时间JIT表会向上调整大小,直到应用程序因内存不足错误而崩溃。
这听起来像内存泄漏吗?如果是,我该如何找到并关闭泄漏?
这是我应用程序的adb shell meminfo。
** MEMINFO in pid 2691 [com.example.deepcliff] **
native dalvik other total
size: 23264 8839 N/A 32103
allocated: 12503 3826 N/A 16329
free: 168 5013 N/A 5181
(Pss): 2512 1395 13815 17722
(shared dirty): 2088 1844 5008 8940
(priv dirty): 2412 224 11316 13952
Objects
Views: 0 ViewRoots: 0
AppContexts: 0 Activities: 0
Assets: 2 AssetManagers: 2
Local Binders: 55 Proxy Binders: 13
Death Recipients: 1
OpenSSL Sockets: 0
SQL
heap: 129 MEMORY_USED: 129
PAGECACHE_OVERFLOW: 9 MALLOC_SIZE: 50
DATABASES
pgsz dbsz Lookaside(b) Dbname
1 14 10 webview.db
1 6 18 webviewCache.db
Asset Allocations
zip:/data/app/com.example.deepcliff-2.apk:/resources.arsc: 17K