thielepaul / photoprism-mobile

Flutter App for PhotoPrism
GNU General Public License v3.0
898 stars 69 forks source link

Uploading large photo batches exceeds memory limits and renders the app unusable #72

Open RAYs3T opened 3 years ago

RAYs3T commented 3 years ago

Tested on a Pixel 4XL

11-26 17:17:18.013 23792 23818 I flutter : ########## Upload new photo ##########
11-26 17:17:18.185   598   610 D libnos_transport: Calling app 0 with params 0x0200
11-26 17:17:18.188   598   610 D libnos_transport: App 0 inspection status=0x00000000 reply_len=0 protocol=1 flags=0x0000
11-26 17:17:18.188   598   610 D libnos_transport: Send app 0 command data (0 bytes)
11-26 17:17:18.188   598   610 D libnos_transport: Send app 0 go command 0x00000200
11-26 17:17:18.189   598   610 D libnos_transport: Polling app 0
11-26 17:17:18.193   598   610 D libnos_transport: App 0 polled=2 status=0x80000000 reply_len=80 flags=0x0000
11-26 17:17:18.193   598   610 D libnos_transport: Read app 0 reply data (80 bytes)
11-26 17:17:18.195   598   610 D libnos_transport: App 0 returning 0x0
11-26 17:17:18.214 23792 23792 I rism.photopris: Waiting for a blocking GC Alloc
11-26 17:17:18.231 23792 23792 I rism.photopris: WaitForGcToComplete blocked Alloc on ProfileSaver for 17.180ms
11-26 17:17:18.231 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.231 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.240 23792 23792 I rism.photopris: Clamp target GC heap from 269MB to 256MB
11-26 17:17:18.240 23792 23792 I rism.photopris: Alloc concurrent copying GC freed 434(26KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 173MB/256MB, paused 23us total 8.292ms
11-26 17:17:18.240 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.244 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.252 23792 23792 I rism.photopris: Clamp target GC heap from 269MB to 256MB
11-26 17:17:18.252 23792 23792 I rism.photopris: Alloc concurrent copying GC freed 3(16KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 173MB/256MB, paused 21us total 8.011ms
11-26 17:17:18.252 23792 23792 I rism.photopris: Forcing collection of SoftReferences for 85MB allocation
11-26 17:17:18.252 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.258 23792 23792 I rism.photopris: Clamp target GC heap from 269MB to 256MB
11-26 17:17:18.258 23792 23792 I rism.photopris: Alloc concurrent copying GC freed 1021(51KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 173MB/256MB, paused 19us total 5.786ms
11-26 17:17:18.258 23792 23792 W rism.photopris: Throwing OutOfMemoryError "Failed to allocate a 90001961 byte allocation with 86202016 free bytes and 82MB until OOM, target footprint 268435456, growth limit 268435456" (VmSize 14618952 kB)
11-26 17:17:18.258 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.258 23792 23792 I chatty  : uid=10348(org.photoprism.photoprism) identical 1 line
11-26 17:17:18.262 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.270 23792 23792 I rism.photopris: Clamp target GC heap from 269MB to 256MB
11-26 17:17:18.270 23792 23792 I rism.photopris: Alloc concurrent copying GC freed 3(16KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 173MB/256MB, paused 20us total 7.934ms
11-26 17:17:18.270 23792 23792 I rism.photopris: Forcing collection of SoftReferences for 85MB allocation
11-26 17:17:18.270 23792 23792 I rism.photopris: Starting a blocking GC Alloc
11-26 17:17:18.276 23792 23792 I rism.photopris: Clamp target GC heap from 269MB to 256MB
11-26 17:17:18.276 23792 23792 I rism.photopris: Alloc concurrent copying GC freed 4(96B) AllocSpace objects, 0(0B) LOS objects, 32% free, 173MB/256MB, paused 17us total 5.675ms
11-26 17:17:18.276 23792 23792 W rism.photopris: Throwing OutOfMemoryError "Failed to allocate a 90001961 byte allocation with 86185656 free bytes and 82MB until OOM, target footprint 268435456, growth limit 268435456" (VmSize 14618952 kB)
11-26 17:17:18.276 23792 23792 D AndroidRuntime: Shutting down VM
11-26 17:17:18.278 23792 23792 E AndroidRuntime: FATAL EXCEPTION: main
11-26 17:17:18.278 23792 23792 E AndroidRuntime: Process: org.photoprism.photoprism, PID: 23792
11-26 17:17:18.278 23792 23792 E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 90001961 byte allocation with 86185656 free bytes and 82MB until OOM, target footprint 268435456, growth limit 268435456
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at java.nio.DirectByteBuffer$MemoryRef.<init>(DirectByteBuffer.java:70)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:258)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:57)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:231)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at top.kikt.imagescanner.util.ResultHandler$reply$1.run(ResultHandler.kt:24)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:938)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:223)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7656)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
11-26 17:17:18.278 23792 23792 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
11-26 17:17:18.280  1550 23865 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
11-26 17:17:18.281  1550  5137 W ActivityTaskManager:   Force finishing activity org.photoprism.photoprism/.MainActivity
czan commented 3 years ago

@RAYs3T A PR of mine just got merged that should help with this issue. Can you retry with a build of current master? There should be an apk on the releases page: https://github.com/photoprism/photoprism-mobile/releases

RAYs3T commented 3 years ago

Hey @czan I will have a look at this in the next days. Sorry for the delay, lots of stuff todo.