mirror of
https://gitee.com/shuto/cordova-imagePicker.git
synced 2026-04-16 00:02:54 +08:00
automatic clear the cache on OutOfMemoryError
This commit is contained in:
@@ -203,6 +203,7 @@ public class ImageFetcher {
|
||||
}
|
||||
}
|
||||
}catch(OutOfMemoryError error) {
|
||||
clearCache();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ public class ImageFetcher {
|
||||
* Garbage Collector.
|
||||
*/
|
||||
|
||||
private static final int HARD_CACHE_CAPACITY = 0;
|
||||
private static final int HARD_CACHE_CAPACITY = 100;
|
||||
private static final int DELAY_BEFORE_PURGE = 10 * 1000; // in milliseconds
|
||||
|
||||
// Hard cache, with a fixed maximum capacity and a life duration
|
||||
@@ -366,8 +367,8 @@ public class ImageFetcher {
|
||||
* after a certain inactivity delay.
|
||||
*/
|
||||
public void clearCache() {
|
||||
// sHardBitmapCache.clear();
|
||||
// sSoftBitmapCache.clear();
|
||||
sHardBitmapCache.clear();
|
||||
sSoftBitmapCache.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user