2-15 second UI freeze due to GC?

331 views
Skip to first unread message

Tobin Harris

unread,
May 7, 2021, 4:19:13 PM5/7/21
to Flutter Development (flutter-dev)
Hi folks

We've distributed our app to 20 Beta testers and 5 of them are reporting the app freezes for 2-15 seconds.

I think I've recreated the freeze by browsing lots of list-views in the app. After some time, the app freezes FOR 5-15s. 

The profiler shows this below, looks like a really long GC event which coincides with the UI freeze?

Anyone else seen this? Or any ideas how to fix it?

image-2.png

Thanks in advance

Suzuki Tomohiro

unread,
May 7, 2021, 5:24:16 PM5/7/21
to Tobin Harris, Flutter Development (flutter-dev)
Use ListView.builder.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/e9a0d7fe-f1b1-44dc-a3c5-9b312acc7a31n%40googlegroups.com.
Message has been deleted

Tobin Harris

unread,
May 7, 2021, 5:34:19 PM5/7/21
to Flutter Development (flutter-dev)

Use ListView.builder.

Thanks. We used this so don't think it's that. Any other thoughts? 

Sawyer Cutler

unread,
May 7, 2021, 6:45:44 PM5/7/21
to Tobin Harris, Flutter Development (flutter-dev)
I agree, ListView.builder is generally the solution there. Without code this is going to be relatively hard to pinpoint since it can be a variety of things.

When the app freezes/stalls is there a specific spot? Any errors being thrown? Can you throw some prints into the build areas and check what the last print is? Is this data being loaded via state, bloc?

More information may not solve it but it can help us understand and hopefully get closer to a solution.

> On May 7, 2021, at 4:34 PM, Tobin Harris <to...@pocketworks.co.uk> wrote:
>

Tobin Harris

unread,
May 8, 2021, 4:35:45 AM5/8/21
to Flutter Development (flutter-dev)
Thanks

I'll triple-check we're using ListView.builder, but pretty sure we are.

Our app is a food app, so I can recreate the freeze by browsing a lot of food lists and scrolling rapidly. After doing this for 10-20 seconds it freezes for 5-15 seconds, and I see a GC event as shown in the image above.

Some users report the app starts freezing quickly, not after too much activity. It can be in various places in the app. I think it's after 

I noticed that there are quite a few NSLayoutConstraint problems that we should fix, although not sure if this is part of the problem.

I can recreate the freeze quite easily on my iPad Pro late 2019. It's very hard to recreate on my iPhone 12 Pro Max. We've got users with good mid-range Android phones having the same issue. I haven't been able to recreate the freeze on my £37 Alcatel One yet!

Our current prime suspects are Cached Network Image and Sembast. But we're really stabbing in the dark. 

We use Fluter Bloc, although there is one place where we don't use that yet and we still get the freeze.

Tough one! 

Tobin Harris

unread,
May 8, 2021, 4:56:51 AM5/8/21
to Flutter Development (flutter-dev)
Here's a user error report (this person is on an iPhone 11)

Went to add a new recipe --> added potato with no issue --> mayonaise --> selection portion 2(30g) app froze for 2-3 seconds.

Then on recipe screen after adding 4 ingredients pressed done. Tried to scroll screen and it froze for about 2 seconds.

Also on home screen searched mayonnaise --> selected from list --> pressed the back button on portion select screen and it froze for 3-4 seconds.

Benedicte Roussel

unread,
May 8, 2021, 8:20:59 PM5/8/21
to Flutter Development (flutter-dev), Tobin Harris
At first glance, I thought, well data problem BUT reading back closely I go more for route problem 

pressed the back button on portion select screen and it froze for 3-4 seconds.
mayonaise --> selection portion 2(30g) app froze for 2-3 seconds.
pressed the back button on portion select screen and it froze for 3-4 seconds.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit

Tobin Harris

unread,
May 9, 2021, 2:26:54 AM5/9/21
to Flutter Development (flutter-dev)
Thanks Bened

As in, something in the routing is causing the freeze?

I suppose we could start by checking the navigation depth, and our popuntil conditions. Is that the kind of thing you'd look at?

Tobin

Tobin Harris

unread,
May 9, 2021, 5:33:24 PM5/9/21
to Flutter Development (flutter-dev)
I've attached an export from the DevTools performance analyser.

This one has a 30 second UI freeze at 583.105ms. This coincides with a GC event (long-lived parallel mark?).

We've swapped CachedNetworkImage for NetworkImage, which had no impact.

Can anyone who understands this better have a guess at what's happening based on the DevTools dump?
dart_devtools_2021_5_9-1620595504450000.json

Benedicte Roussel

unread,
May 11, 2021, 5:10:37 PM5/11/21
to Tobin Harris, Flutter Development (flutter-dev)
I said route because reading the reports from your users I could see that data were arriving  or were added without problem but then once that  done , a 'future' I guess  redirect the user to some route and it is at that moment there are some IO bound
Now I may be wrong in my approach





Le dim., mai 9, 2021 à 23:33, Tobin Harris
Reply all
Reply to author
Forward
0 new messages