android – volley磁盘缓存的内存不足问题

android – volley磁盘缓存的内存不足问题,第1张

概述在我的 Android应用程序中,我使用Volley在自定义列表视图中加载图像. 当我刷新(删除所有项目并加载tiems)listview很多次, 我的应用程序被此消息杀死 我该怎么办呢? 04-26 13:08:01.038: E/dalvikvm-heap(18040): Out of memory on a 1684947261-byte allocation. 04-26 13:08:01 在我的 Android应用程序中,我使用Volley在自定义列表视图中加载图像.

当我刷新(删除所有项目并加载tIEms)@R_419_6818@vIEw很多次,
我的应用程序被此消息杀死

我该怎么办呢?

04-26 13:08:01.038: E/dalvikvm-heap(18040): Out of memory on a 1684947261-byte allocation.
04-26 13:08:01.038: I/dalvikvm(18040): “Thread-11094″ prio=5 tID=299 RUNNABLE
04-26 13:08:01.038: I/dalvikvm(18040): | group=”main” sCount=0 dsCount=0 obj=0x439ea8e8 self=0x7fb55250
04-26 13:08:01.038: I/dalvikvm(18040): | sysTID=18946 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=2102160344
04-26 13:08:01.038: I/dalvikvm(18040): | state=R schedstat=( 109248225 27367764 57 ) utm=9 stm=1 core=2
04-26 13:08:01.038: I/dalvikvm(18040): at com.androID.volley.toolBox.diskBasedCache.streamToBytes(diskBasedCache.java:~316)
04-26 13:08:01.038: I/dalvikvm(18040): at com.androID.volley.toolBox.diskBasedCache.readString(diskBasedCache.java:526)
04-26 13:08:01.038: I/dalvikvm(18040): at com.androID.volley.toolBox.diskBasedCache.readStringStringMap(diskBasedCache.java:549)
04-26 13:08:01.038: I/dalvikvm(18040): at com.androID.volley.toolBox.diskBasedCache$Cacheheader.readheader(diskBasedCache.java:392)
04-26 13:08:01.038: I/dalvikvm(18040): at com.androID.volley.toolBox.diskBasedCache.initialize(diskBasedCache.java:155)
04-26 13:08:01.038: I/dalvikvm(18040): at com.androID.volley.Cachedispatcher.run(Cachedispatcher.java:84)
04-26 13:08:01.048: W/dalvikvm(18040): threadID=299: thread exiting with uncaught exception (group=0x41745da0)
04-26 13:08:01.048: I/SpenGestureManager(847): setFocusWindow0
04-26 13:08:01.048: D/PointerIcon(847): setHoveringSpenIconStyle1 pointerType: 10001iconType:1 flag:0
04-26 13:08:01.048: D/PointerIcon(847): setHoveringSpenCustomIcon IconType is same.1
04-26 13:08:01.048: E/AndroIDRuntime(18040): FATAL EXCEPTION: Thread-11094
04-26 13:08:01.048: E/AndroIDRuntime(18040): Process: com.androID.myapp,PID: 18040
04-26 13:08:01.048: E/AndroIDRuntime(18040): java.lang.OutOfMemoryError
04-26 13:08:01.048: E/AndroIDRuntime(18040): at com.androID.volley.toolBox.diskBasedCache.streamToBytes(diskBasedCache.java:316)
04-26 13:08:01.048: E/AndroIDRuntime(18040): at com.androID.volley.toolBox.diskBasedCache.readString(diskBasedCache.java:526)
04-26 13:08:01.048: E/AndroIDRuntime(18040): at com.androID.volley.toolBox.diskBasedCache.readStringStringMap(diskBasedCache.java:549)
04-26 13:08:01.048: E/AndroIDRuntime(18040): at com.androID.volley.toolBox.diskBasedCache$Cacheheader.readheader(diskBasedCache.java:392)
04-26 13:08:01.048: E/AndroIDRuntime(18040): at com.androID.volley.toolBox.diskBasedCache.initialize(diskBasedCache.java:155)
04-26 13:08:01.048: E/AndroIDRuntime(18040): at com.androID.volley.Cachedispatcher.run(Cachedispatcher.java:84)
04-26 13:08:01.058: W/ActivityManager(847): Force finishing activity com.androID.myapp/.Feed@R_419_6818@.Feed@R_419_6818@

解决方法 你有没有尝试过
RequestQueue volleyQueue = Volley.newRequestQueue(this);diskBasedCache cache = new diskBasedCache(getCacheDir(),16 * 1024 * 1024);volleyQueue = new RequestQueue(cache,new BasicNetwork(new HurlStack()));volleyQueue.start();

https://stackoverflow.com/a/21299261/3399432

这会更改缓存大小

总结

以上是内存溢出为你收集整理的android – volley磁盘缓存的内存不足问题全部内容,希望文章能够帮你解决android – volley磁盘缓存的内存不足问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1134925.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存