Closed Tobibur closed 5 years ago
Hi, I'm busy these days, could you please do some investigation about this problem? PR is welcome!
我是在自定义Application中创建一个方法通过反射清理掉引用,在对应的Activity的onDestroy生命周期调用一下cleanGlideLoading()
public void cleanGlideLoading() {
Field mRequestTargetMap = null;
try {
mRequestTargetMap = mGlideImageLoader.getClass().getDeclaredField("mRequestTargetMap");
mRequestTargetMap.setAccessible(true);
Map map = (Map) mRequestTargetMap.get(mGlideImageLoader);
map.clear();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
@xujiaji 可以考虑为 ImageLoader 增加一个接口,用于显式清理资源,供使用者调用。欢迎提交 PR。
This is a very nice & useful library you made. I was checking the sample app and got this memory leak notification.