Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多次加载大图OOM的情况 #19

Open
JamesLiAndroid opened this issue Apr 6, 2017 · 4 comments
Open

多次加载大图OOM的情况 #19

JamesLiAndroid opened this issue Apr 6, 2017 · 4 comments

Comments

@JamesLiAndroid
Copy link

我在多次加载不同的大图之后,发现最后OOM了,如何进行处理和避免?

@JamesLiAndroid
Copy link
Author

还有就是如何进行内存的释放?

@LuckyJayce
Copy link
Owner

View 持有图片,所以view不被持有等待GC回收的时候回收图片
onDetachedFromWindow的时候取消加载图片
你多次加载大图是用在什么样的场景
LargeImageView一般用在ViewPager里面,可缩放
UpdateImageView可以用在列表上,不可以缩放

@JamesLiAndroid
Copy link
Author

应该是我这边的问题,就是从列表中进入查看详情的时候,应该是每一次退出详情页面的时候没有对图片的引用进行手动回收,导致多次打开详情页面时,内存就oom了。我这边用的图片也是相当大(8k的长,1k的宽),所以我临时的解决方案是压缩了图片,质量变为原来的60%。我想知道的是,如何进行手动释放?光引用手动至空应该是不行的吧!

@LuckyJayce
Copy link
Owner

图片加载已经优化,更新最新的库试下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants