Forum Xamarin Xamarin.Android

Garbage collection spam and crash when requesting Interstitial ad with google play services?

Riley19280Riley19280 USMember
edited July 2016 in Xamarin.Android

ive built an app using xamarin forms and am having problems with my android build. i am using google play services - ads to serve ads from admob. every time i request an interstitial ad i end up with all this garbage collection spam, along with a frozen app, im not sure what the problem is.


GC spam:

{07-13 13:57:36.108 D/Mono (30264): GC_MAJOR: (user request) pause 4.91ms, total 5.33ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.138 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 610us total 18.476ms
07-13 13:57:36.138 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.16ms sort 0.01ms dfs2 0.32ms setup-cb 0.11ms free-data 0.09ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.138 D/Mono (30264): GC_MAJOR: (user request) pause 5.14ms, total 5.22ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.158 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 591us total 18.791ms
07-13 13:57:36.168 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.15ms sort 0.01ms dfs2 0.35ms setup-cb 0.12ms free-data 0.09ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.168 D/Mono (30264): GC_MAJOR: (user request) pause 5.12ms, total 5.18ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.188 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 570us total 19.312ms
07-13 13:57:36.188 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.17ms sort 0.01ms dfs2 0.31ms setup-cb 0.11ms free-data 0.09ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.188 D/Mono (30264): GC_MAJOR: (user request) pause 5.12ms, total 5.19ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.218 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 882us total 25.229ms
07-13 13:57:36.228 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.15ms sort 0.01ms dfs2 0.33ms setup-cb 0.11ms free-data 0.07ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.228 D/Mono (30264): GC_MAJOR: (user request) pause 4.70ms, total 4.79ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.248 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 570us total 21.121ms
07-13 13:57:36.258 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.17ms sort 0.01ms dfs2 0.31ms setup-cb 0.11ms free-data 0.07ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.258 D/Mono (30264): GC_MAJOR: (user request) pause 5.77ms, total 5.87ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.278 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 575us total 19.434ms
07-13 13:57:36.278 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.14ms sort 0.00ms dfs2 0.26ms setup-cb 0.09ms free-data 0.06ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.278 D/Mono (30264): GC_MAJOR: (user request) pause 4.50ms, total 4.55ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.308 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 571us total 18.182ms
07-13 13:57:36.308 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.16ms sort 0.01ms dfs2 0.26ms setup-cb 0.10ms free-data 0.06ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.308 D/Mono (30264): GC_MAJOR: (user request) pause 4.90ms, total 4.96ms, bridge 0.00ms major 1104K/1104K los 22K/0K
07-13 13:57:36.328 I/art (30264): Explicit concurrent mark sweep GC freed 6(272B) AllocSpace objects, 0(0B) LOS objects, 40% free, 20MB/34MB, paused 580us total 18.159ms
07-13 13:57:36.338 D/Mono (30264): GC_OLD_BRIDGE num-objects 27 num_hash_entries 28 sccs size 28 init 0.00ms df1 0.19ms sort 0.00ms dfs2 0.27ms setup-cb 0.09ms free-data 0.05ms links 2/2/2/1 dfs passes 57/30
07-13 13:57:36.338 D/Mono (30264): GC_MAJOR: (user request) pause 4.68ms, total 4.73ms, bridge 0.00ms major 1104K/1104K los 22K/0K}


code requesting the ad:


    InterstitialAd _ad;
    bool reqAd = true;

    public void Request(string adUnit)
    {
        if (reqAd == true && MANAGER.ENABLEADS)
        {
            _ad = new InterstitialAd(Application.Context);
            _ad.AdUnitId = adUnit;

            var intlistener = new InterstitialAdListener(_ad);
            intlistener.OnAdLoaded();
            intlistener.OnAdOpened();
            intlistener.OnAdClosed();
            intlistener.OnAdLeftApplication();


            _ad.AdListener = intlistener;

            var requestbuilder = new AdRequest.Builder().AddTestDevice("CD0D9F143549110573451D43B4DA9859");
            requestbuilder.AddTestDevice("77B08A4FA88832D62AF6BBDB31038A05");
            _ad.LoadAd(requestbuilder.Build());
            reqAd = false;
        }
    }

    public void Show()
    {
        if (_ad.IsLoaded && _ad != null && MANAGER.ENABLEADS)
        {
            _ad.Show();
            reqAd = true;
        }
    }

Called with:

DependencyService.Get<IAdmobInterstitial>().Request(Constants.InterstitialID);

any advice and/or solutions would be appreciated! thanks!

Sign In or Register to comment.