Hello,
I have a free and paid version of the app. The free version uses a Banner ad at the bottom. The app is simple and has just one activity.
The adview is created using application context and added to the view hierarchy.
- Google Play services SDK version you're integrating with -> com.google.android.gms:play-services-ads:10.2.0
- Version of the Google Play services apk installed on your device -> 9.8.75 (470-133986348)
- model and OS version of the device that exhibits the issue -> Emulator, API 25, Skin Nexus 6P
- Your SDK integration code, if relevant
Use case is just to launch the activity and press back to finish the activity ( after the first ad is displayed ) and initiate GC via Android Studio's Memory Monitor and collect memory info.
Paid version (without ad)
Pss Private Private SwapPss Heap Heap Heap
Total Dirty Clean Dirty Size Alloc Free
------ ------ ------ ------ ------ ------ ------
Native Heap 14387 14328 0 0 19968 16386 3581
Dalvik Heap 2040 1816 0 0 9393 7345 2048
Dalvik Other 773 772 0 0
Stack 408 408 0 0
Ashmem 4 4 0 0
Other dev 12 0 12 0
.so mmap 1422 132 136 0
.apk mmap 376 0 52 0
.ttf mmap 43 0 0 0
.dex mmap 4523 16 3816 0
.oat mmap 2599 0 584 0
.art mmap 2010 1384 256 0
Other mmap 15 4 0 0
Unknown 1517 1516 0 0
TOTAL 30129 20380 4856 0 29361 23731 5629
App Summary
Pss(KB)
------
Java Heap: 3456
Native Heap: 14328
Code: 4736
Stack: 408
Graphics: 0
Private Other: 2308
System: 4893
TOTAL: 30129 TOTAL SWAP PSS: 0
Objects
Views: 0 ViewRootImpl: 0
AppContexts: 1 Activities: 0
Assets: 2 AssetManagers: 2
Local Binders: 15 Proxy Binders: 18
Parcel memory: 5 Parcel count: 22
Death Recipients: 0 OpenSSL Sockets: 2
WebViews: 0
SQL
MEMORY_USED: 0
PAGECACHE_OVERFLOW: 0 MALLOC_SIZE: 62
Free version (with banner ad)
Pss Private Private SwapPss Heap Heap Heap
Total Dirty Clean Dirty Size Alloc Free
------ ------ ------ ------ ------ ------ ------
Native Heap 30474 30396 0 0 41088 32210 8877
Dalvik Heap 2531 2232 0 0 9914 7866 2048
Dalvik Other 1302 1300 0 0
Stack 800 800 0 0
Ashmem 160 132 0 0
Other dev 12 0 12 0
.so mmap 1809 148 232 0
.apk mmap 23780 96 21340 0
.ttf mmap 57 0 4 0
.dex mmap 8261 24 7036 0
.oat mmap 4788 0 1684 0
.art mmap 2823 2068 280 0
Other mmap 1077 4 1004 0
Unknown 7251 7248 0 0
TOTAL 85125 44448 31592 0 51002 40076 10925
App Summary
Pss(KB)
------
Java Heap: 4580
Native Heap: 30396
Code: 30564
Stack: 800
Graphics: 0
Private Other: 9700
System: 9085
TOTAL: 85125 TOTAL SWAP PSS: 0
Objects
Views: 6 ViewRootImpl: 0
AppContexts: 1 Activities: 0
Assets: 3 AssetManagers: 2
Local Binders: 30 Proxy Binders: 26
Parcel memory: 8 Parcel count: 32
Death Recipients: 0 OpenSSL Sockets: 0
WebViews: 2
SQL
MEMORY_USED: 0
PAGECACHE_OVERFLOW: 0 MALLOC_SIZE: 62
The memory increase for the free app is ~55 MB ( Total Pss ), ~24 MB ( private dirty ) and ~27 MB ( private clean ).
No amount of GC reduces this memory despite the fact that the activity has been destroyed. The meminfo doesn't list any activity.
However, it does claim 6 views and 2 web views. I do call destroy() on my AdView when the activity is destroyed.
The significant difference come from Native heap & apk mmap. How could i possibly debug this?
At some point my app launches a foreground service and users see this memory usage in running services and i get quite a few low ratings just because of the memory usage.
Could anyone give some pointers?
- Vairavan