Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25540] Android: onTrimMemory can cause crash

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2018-01-04T02:12:59.000+0000
Affected Version/sRelease 7.0.0, Release 6.3.0
Fix Version/sRelease 7.0.2
ComponentsAndroid
Labelsn/a
ReporterGary Mathews
AssigneeGary Mathews
Created2017-11-20T17:55:56.000+0000
Updated2018-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

Comments

  1. Gary Mathews 2017-11-20

    master: https://github.com/appcelerator/titanium_mobile/pull/9620
  2. Gary Mathews 2018-01-23

    7_0_X: https://github.com/appcelerator/titanium_mobile/pull/9764
  3. Abir Mukherjee 2018-01-23

    Tested 7.0.2 backport version, and FR passed.
  4. Abir Mukherjee 2018-01-25

    Fix verified in 7.0.2 RC version and master.

JSON Source