Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid AdMob memory usage
    primarykey
    data
    text
    <p>I'm confused about how much memory <strong>AdMob SDK</strong> seem to be using, and where this memory is actually located. Let me explain.</p> <p>I've got two flavors of my app: Free and Paid. Free version has AdMob ads, otherwise the code is almost the same (common Android lib used).</p> <p>I run the apps on my Nexus 4 (Android 4.2.1) and compare memory usage. I look at system memory used by the app in device settings > apps > running. I also look at the Dalvik heap memory as reported by GC logcat messages, and using HPROF files.</p> <p>When I run Paid version I can see:</p> <ul> <li>System memory: About <strong>16MB</strong> </li> <li>Dalvik heap size: About 10MB</li> </ul> <p>When I run the Free version I can see:</p> <ul> <li>System memory: About <strong>29MB</strong></li> <li>Dalvik heap size: About 11MB</li> </ul> <p>In other words, the dalvik heap size is similar for both versions. But the actual <strong>system memory</strong> used is <strong>10MB+ higher</strong>!</p> <p>Having spent time learning about memory profiling (<a href="http://www.youtube.com/watch?feature=player_embedded&amp;v=_CruQY55HOk">http://www.youtube.com/watch?feature=player_embedded&amp;v=_CruQY55HOk</a>), and hours looking at HPROF files to remove any possible leak, I can only see only one conclusion:</p> <p><strong>The 10MB extra system memory used by AdMob is actually native memory, allocated using malloc, outside of dalvik heap!</strong></p> <p>Now I'm wondering about two things:</p> <ol> <li>I believe that since Free version system memory is 10MB bigger than Paid version, it is much more prone to be killed by OS in case of memory pressure. Or does the Android OS only take into account the Dalvik heap for deciding which app to kill?</li> <li>Is there a way to tune AdMob SDK to select how much memory it is allowed to allocate?</li> </ol> <p>Thank's a lot </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload