[TIMOB-25540] Android: onTrimMemory can cause crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-01-04T02:12:59.000+0000 |
Affected Version/s | Release 7.0.0, Release 6.3.0 |
Fix Version/s | Release 7.0.2 |
Components | Android |
Labels | n/a |
Reporter | Gary Mathews |
Assignee | Gary Mathews |
Created | 2017-11-20T17:55:56.000+0000 |
Updated | 2018-01-25T19:51:52.000+0000 |
Description
-
onTrimMemory
can cause an exception when attempting to release memory:
FATAL EXCEPTION: main
Process: com.titanium.test, PID: 7535
java.lang.IllegalStateException: org.appcelerator.titanium.util.TiBlobLruCache.sizeOf() is reporting inconsistent results!
at android.support.v4.util.LruCache.trimToSize(LruCache.java:168)
at android.support.v4.util.LruCache.evictAll(LruCache.java:272)
at org.appcelerator.titanium.TiApplication.onTrimMemory(TiApplication.java:417)
at android.app.ActivityThread.handleTrimMemory(ActivityThread.java:5369)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1800)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
*TEST CASE*
- Download an image first
- Run app and select image from Downloads folder
- Press back to exit app
Ti.Media.openPhotoGallery({
success:function(event) {
var image = event.media.imageAsResized(300, 300);
console.log('resized image');
}
});
NOTE: this is happening on Android 8.0
master: https://github.com/appcelerator/titanium_mobile/pull/9620
7_0_X: https://github.com/appcelerator/titanium_mobile/pull/9764
Tested 7.0.2 backport version, and FR passed.
Fix verified in 7.0.2 RC version and master.