Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application UI freezes with GC messages

Hi I am having a trouble with my android app. When the data is being entered in the database , Database query for reading data is not working and it freezes the UI with the following Logcat message.

  12-24 12:01:56.261: I/art(16943): Explicit concurrent mark sweep GC freed 33437(1578KB)    AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 724us total 84.428ms
 12-24 12:01:57.050: I/art(16943): Explicit concurrent mark sweep GC freed 13651(640KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 929us total 94.389ms
 12-24 12:01:57.708: I/art(16943): Explicit concurrent mark sweep GC freed 13625(637KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 3.232ms total 77.678ms
 12-24 12:01:58.472: I/art(16943): Explicit concurrent mark sweep GC freed 13652(638KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 960us total 83.427ms
 12-24 12:01:59.221: I/art(16943): Explicit concurrent mark sweep GC freed 13884(648KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 817us total 77.259ms
 12-24 12:01:59.949: I/art(16943): Explicit concurrent mark sweep GC freed 13929(652KB) AllocSpace objects, 0(0B) LOS objects, 38% free, 25MB/41MB, paused 1.483ms total 67.075ms
 12-24 12:02:00.657: I/art(16943): Explicit concurrent mark sweep GC freed 13901(649KB) AllocSpace objects, 0(0B) LOS objects, 38% free, 25MB/41MB, paused 1.158ms total 87.732ms

I am not able to understand why is this happening. Any help would be appreciated. Thanks!!

like image 312
user2781627 Avatar asked Dec 24 '14 06:12

user2781627


People also ask

What is UI freeze?

UI Freeze The UI Freeze event indicates time intervals where the application was unable to respond to user input. More specifically, these are time intervals where window messages were not pumped for more than 200 ms or processing of a particular message took more than 200 ms.


1 Answers

Surely you are doing job on the Main Thread (UI Thread). you HAVE to do this job on a background thread meanwhile showing a loading or never-ending animation to show the user you are working on something.

Otherwise this kind of messages of GC are normal and are not a problem, any normal app could throw this messages.

You get an ANR problem 10sec after the start of the app? if so, it's 100% that the problem, you are working on the ui thread.

Hope this helps.

like image 113
Sulfkain Avatar answered Oct 29 '22 02:10

Sulfkain