[問題] WIFI Suspending all Thread及GC Freed問題

看板AndroidDev作者 (Dream)時間8年前 (2016/07/07 18:34), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
請問 我目前在做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://www.ptt.cc/bbs/AndroidDev/M.1467887699.A.278.html
文章代碼(AID): #1NVZ1J9u (AndroidDev)