使用fresco框架加载图片时,一次性加载70多张就会出现OOM,该如何解决 2C

I/art: Starting a blocking GC Alloc
02-08 15:40:00.307 15871-15871/android.ye.fashioncircle I/art: Clamp target GC heap from 207MB to 192MB
02-08 15:40:00.307 15871-15871/android.ye.fashioncircle I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 0% free, 191MB/192MB, paused 773us total 41.748ms
02-08 15:40:00.308 15871-15871/android.ye.fashioncircle I/art: Forcing collection of SoftReferences for 1406KB allocation
02-08 15:40:00.308 15871-15871/android.ye.fashioncircle I/art: Starting a blocking GC Alloc
02-08 15:40:00.349 15871-15871/android.ye.fashioncircle I/art: Clamp target GC heap from 207MB to 192MB
02-08 15:40:00.349 15871-15871/android.ye.fashioncircle I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 0% free, 191MB/192MB, paused 789us total 40.572ms
02-08 15:40:00.351 15871-15871/android.ye.fashioncircle W/art: Throwing OutOfMemoryError "Failed to allocate a 1440012 byte allocation with 200488 free bytes and 195KB until OOM"
02-08 15:40:00.351 15871-15871/android.ye.fashioncircle D/skia: --- allocation failed for scaled bitmap
02-08 15:40:00.352 15871-15871/android.ye.fashioncircle D/AndroidRuntime: Shutting down VM
02-08 15:40:00.355 15871-15871/android.ye.fashioncircle I/art: Waiting for a blocking GC Alloc
02-08 15:40:00.361 15871-15871/android.ye.fashioncircle I/art: WaitForGcToComplete blocked for 5.461ms for cause Alloc
02-08 15:40:00.361 15871-15871/android.ye.fashioncircle I/art: Starting a blocking GC Alloc
02-08 15:40:00.673 7773-7780/android.ye.fashioncircle A/art: art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
02-08 15:40:00.673 7773-7780/android.ye.fashioncircle A/art: art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
02-08 15:40:00.673 7773-7780/android.ye.fashioncircle A/art: art/runtime/runtime.cc:366]
这样的时候界面出现卡顿,然后就OOM闪退了
该如何解决。。。
页面是一个scrollview嵌套recyclerview使得分页加载失效,一次性加载了所有的图片
换成Glide和ImageLoader也是OOM

4个回答

为什么要用scrollview嵌套recycleview,分页加载还是要的,即便没有分页加载也不会一次性全部加载吧,按道理本身应该recycleview只会加载显示的图片的

嵌套滚动可以看看NestedScrollView

yyy000112
yyy000112 在scrollview里嵌套recycleview禁用recyclerview滑动,需要知道总高度才行,一旦定了总高度,分页也就失效了,相当于一次性全部推拉上去了
2 年多之前 回复

给recycleview一个指定高度,使它不显示所有图片

m0_37144584
roc_tootwo 回复yyy000112: 如果scrollView和Recyclerview是同向滚动的话,为什么要嵌套,能说一下你的需求吗
2 年多之前 回复
yyy000112
yyy000112 现在我是指定了item全部加载后的高度,如果指定一小部分的高度的话,其他item将无法显示
2 年多之前 回复

加载多的时候分页加载还是必要的

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!