作者mouse52055 (Dream)
看板AndroidDev
标题[问题] WIFI 暂停Thread及GC Freed问题
时间Thu Jul 7 18:34:54 2016
请问
我目前在做WIFI APP(TCP Socket)
接收资料的方式是在Thread中跑 while ((length = in.read(b)) > 0)
(in是BufferedInputStream)
但是我在执行时Log都会一直跑Suspending all threads took和GC freed,如下列Log,不晓得这样在程式执行中是否会有影响?
W/art: Suspending all threads took: 15.001ms
W/art: Suspending all threads took: 5.784ms
W/art: Suspending all threads took: 35.113ms
I/art: Background partial concurrent mark sweep GC freed 205782(7MB) AllocSpace objects, 0(0B) LOS objects, 38% free, 25MB/41MB, paused 6.996ms total 60.501ms
I/art: Background partial concurrent mark sweep GC freed 208097(7MB) AllocSpace objects, 0(0B) LOS objects, 38% free, 25MB/41MB, paused 5.866ms total 53.566ms
I/art: Background sticky concurrent mark sweep GC freed 231047(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 25MB/33MB, paused 6.354ms total 85.863ms
会有多个Client连接近来,并每秒传送20笔左右的资料(每笔 1412Byte)至APP做显示功能
主要的问题是,(Suspending all threads took)和(GC freed),是否会影响App的流畅度,是否有解决的方法?已爬过网路上很多文章,但是还是不知道该怎麽解决。
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.110.213.56
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1467887699.A.278.html