Forum Xamarin.Forms

How to resolve "Starting a blocking GC Explicit " --- I/art

Renuka3Renuka3 Member ✭✭

In Xamarin application while animating any image or object I am getting this error frequently & animation gets stuck.

I/art (17219): Starting a blocking GC Explicit
I/art (17219): Explicit concurrent mark sweep GC freed 27546(495KB) AllocSpace objects, 7(3MB) LOS objects, 5% free, 263MB/279MB, paused 1.788ms total 346.941ms
D/Mono (17219): GC_TAR_BRIDGE bridges 56 objects 62 opaque 0 colors 56 colors-bridged 56 colors-visible 56 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.05ms tarjan 0.04ms scc-setup 0.05ms gather-xref 0.00ms xref-setup 0.00ms cleanup 0.07ms
D/Mono (17219): GC_BRIDGE: Complete, was running for 351.91ms
D/Mono (17219): GC_MINOR: (Nursery full) time 15.95ms, stw 16.90ms promoted 331K major size: 133232K in use: 126452K los size: 23552K in use: 19741K

Please suggest how can I reduce this kind of exception.

Thank you.

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited April 2019

    There may be much work on the UI thread in your app.Try to move to a non-UI thread or break up the work into smaller pieces that are done over time rather than in one chunk? Make sure the UI thread have some "idle" time, so that it can respond to the user's actions.

    Try the follows

    1. async/await with Task.Run and Device.BeginInvokeOnMainThread (or other methods of managing threads) using virtualisation offered by ListView instead of building large StackLayouts
    2. lazy loading

    Refer to https://forums.xamarin.com/discussion/comment/365208#Comment_365208

Sign In or Register to comment.