android / android/camera-samples

Out of Memory when running CameraXTfLite for 25 minutes

Offen
#345 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
5.5k
Forks
2.4k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I'm tring to write an App similar to the TfLite example but am running into out of memory problems. I see the same or similar problems with the TfLite sample:

After ~ 25 minutes I get the following creash on my Moto G5 (Another One plus device appears unaffected but maybe this has more memory?)

I've tried profiling but this shows nothing odd to me
![image](https://user-images.githubusercontent.com/11753801/103645471-efda3d80-4f4f-11eb-85be-f9e4309000a2.png)

```
I/zygote: Background concurrent copying GC freed 23227(790KB) AllocSpace objects, 4(2MB) LOS objects, 50% free, 3MB/7MB, paused 188us total 119.649ms
D/CameraActivity: FPS: 0.92
D/CameraActivity: FPS: 0.88
W/Adreno-GSL: : sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL: : GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL: : sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL: : GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL: : sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL: : GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL: : sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL: : GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL: : sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL: : GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
E/OpenGLRenderer: GL error: Out of memory!
A/OpenGLRenderer: glTexImage2D error! GL_OUT_OF_MEMORY (0x505)
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 13394 (RenderThread), pid 13179 (.camerax.tflite)
I/zygote: Background concurrent copying GC freed 31173(1010KB) AllocSpace objects, 6(4MB) LOS objects, 49% free, 4MB/9MB, paused 2.447ms total 100.477ms
Disconnected from the target VM, address: 'localhost:61371', transport: 'socket'

```

WIth my App it fails in a similar manner after 20 minutes or so e.g:

```
D/CameraDetector$getAnalyzer: FPS: 0.80
I/CameraDetector$getAnalyzer: Debug native heap = 49, free = 19, used = 29 MB
I/CameraDetector$getAnalyzer: MemInfo heap = 1867, free = 631, used = 1235 MB
I/zygote: Background concurrent copying GC freed 27121(977KB) AllocSpace objects, 6(4MB) LOS objects, 49% free, 7MB/14MB, paused 167us total 320.182ms
I/zygote: Background concurrent copying GC freed 38487(1236KB) AllocSpace objects, 12(8MB) LOS objects, 49% free, 6MB/12MB, paused 680us total 352.515ms
D/CameraDetector$getAnalyzer: FPS: 0.90
I/CameraDetector$getAnalyzer: Debug native heap = 49, free = 19, used = 30 MB
I/CameraDetector$getAnalyzer: MemInfo heap = 1867, free = 642, used = 1224 MB
W/libc: pthread_create failed: couldn't allocate 1036288-bytes mapped space: Out of memory
E/libc++abi: terminating with uncaught exception of type std::__1::system_error: thread constructor failed: Try again
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 6922 (pool-2-thread-1), pid 26789 (.android.camcam)
I/zygote: Background concurrent copying GC freed 39837(1268KB) AllocSpace objects, 8(5MB) LOS objects, 49% free, 5MB/11MB, paused 367us total 212.356ms
Disconnected from the target VM, address: 'localhost:59287', transport: 'socket'
```
The memory heap debug reports suggest that there is plenty of memory available. Maybe it becomes too fragmented?

Any ideas suggestions?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, das CameraXTfLite-Beispiel auf dem Moto G5 zu reproduzieren, und untersuche den Pfad CameraDetector$getAnalyzer zusammen mit den gemeldeten Heap-, GPU- und Thread-Allocation-Logs. Verfolge, ob sich Kamera-, Analyzer- oder Bildressourcen während eines 20–25-minütigen Laufs ansammeln; abgeschlossen ist die Aufgabe, wenn das Beispiel auf dem betroffenen Gerät nicht mehr den gemeldeten Out-of-Memory-Absturz erreicht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
kotlin
Bereich
computer-vision, mobile
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.