Android
Android out of memory error [Glide]
Gibson 김형섭
2016. 4. 6. 15:59
out of memory exception
Glide library 사용 시 이미지 캐시로 인한 메모리부족 현상이다.
우선 어플리케이션 메모리heap을 늘려준다,
Manifest에 android:largeHeap="true"
자신의 BaseApplication 클래스에
public class BaseApplication extends Application {
@Override
public void onLowMemory() {
super.onLowMemory();
Glide.get(this).clearMemory();
}
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
Glide.get(this).trimMemory(level);
}
를 추가해줌으로서 메모리 사용량에 따라 캐시데이터를 지우거나 잘라 낼 수 있다.
*참조 http://stackoverflow.com/questions/32915174/android-outofmemory-error-imageview