Interstitial ad OutOfMemoryError

460 views
Skip to first unread message

Marco Batista

unread,
Oct 27, 2015, 4:31:07 AM10/27/15
to Google Mobile Ads SDK Developers
Hello, for past month I have been noticing a huge increase in Out Of Memory Errors while trying to display a full screen ad.
This usually happened rarely, and only on low end devices, but now is happening more often and on all types of devices (like Samsung S3, S4, S5, S6, S6 Edge, other lower and mid end Samsung, ASUS, XIAOMI phones, etc...).
This happens on Android 4.2.2 to 5.1.1.

I'm using the latest Google Play Services lib.

Stacktrace:

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 7896484 free bytes and 7MB until OOM
       at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
       at android.graphics.Bitmap.nativeCreate(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java)
       at com.google.android.gms.ads.internal.util.q.f(SourceFile)
       at com.google.android.gms.ads.internal.u.f(SourceFile)
       at com.google.android.gms.ads.internal.client.ac.onTransact(SourceFile)
       at android.os.Binder.transact(Binder.java)
       at com.google.android.gms.ads.internal.client.zzs$zza$zza.showInterstitial(Unknown Source)
       at com.google.android.gms.ads.internal.client.zzaa.show(Unknown Source)
       at com.google.android.gms.ads.InterstitialAd.show(Unknown Source)

Vu Chau (MobileAds SDK Team)

unread,
Oct 27, 2015, 4:37:48 PM10/27/15
to Google Mobile Ads SDK Developers
Hi Marco,

Is this issue reproducible using our sample app?  Would you mind sharing some implementation details that are relevant to getting this OutOfMemoryError?

Thanks,

Vu Chau
Mobile Ads SDK Team

Marco Batista

unread,
Oct 29, 2015, 5:33:30 PM10/29/15
to Google Mobile Ads SDK Developers
Hello Vu,

I can't reproduce in any of our devices, the information I shared is from Crashlytics reports.

The implementation is simple, the app is a game and ad is loaded when the game starts (onCreate of the Activity).
Then when the user loses/game ends I show the ad.

Code:

//OnCreate of the Activity
        interstitial = new InterstitialAd(context);
        interstitial.setAdUnitId(getString(R.string.admob_key));

        interstitial.setAdListener(this);

        AdRequest adRequest = new AdRequest.Builder().build();
        interstitial.loadAd(adRequest);

//Then on game over
        if(interstitial != null && interstitial.isLoaded())
{
             interstitial.show();//This is the line where I get the OOM error on the reports
}

Vu Chau (MobileAds SDK Team)

unread,
Oct 30, 2015, 9:43:00 AM10/30/15
to Google Mobile Ads SDK Developers
Hi Marco,

Thanks for the details! Your code snippets look fine to me, but keep in mind that occasionally an interstitial might be big in size and consequently could cause an OOM error during rendering.  In that case you will want to locate the network that serves such interstitials, and have a discussion with them or temporarily block them from serving.

Once you've been able to reproduce this issue and have some reliable steps for doing so, send them our way and we'll be happy to continue troubleshooting.

Cheers,

Vu Chau
Mobile Ads SDK Team

Don Naipe

unread,
Nov 10, 2015, 11:20:18 AM11/10/15
to Google Mobile Ads SDK Developers
Hello, I'm having the same issue as Marco Batista.
The network is Admob in my case.

See for instance this stacktrace:

java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 7163598 free bytes and 6MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:939)
at android.graphics.Bitmap.createBitmap(Bitmap.java:912)
at android.graphics.Bitmap.createBitmap(Bitmap.java:879)
at com.google.android.gms.ads.internal.util.s.f(SourceFile:1029)
at com.google.android.gms.ads.internal.u.f(SourceFile:318)
at com.google.android.gms.ads.internal.client.aa.onTransact(SourceFile:121)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.ads.internal.client.f.showInterstitial(Unknown Source)

at com.google.android.gms.ads.internal.client.zzaa.show(Unknown Source)
at com.google.android.gms.ads.InterstitialAd.show(Unknown Source)
at donnaipe.europoly.actividades.bw.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

Vu Chau (MobileAds SDK Team)

unread,
Nov 10, 2015, 4:46:49 PM11/10/15
to Google Mobile Ads SDK Developers
Hi Don,

Thanks for looping us in with regards to the OOM error you are seeing.  If you have the details I asked Marco for in my previous responses, send them over so the team can begin looking into resolving the issue.

Thanks!

Vu Chau
Mobile Ads SDK Team

Reply all
Reply to author
Forward
0 new messages