android / android/camera-samples

Out of Memory when running CameraXTfLite for 25 minutes

Aperta
#345 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Kotlin
Stelle
5.5k
Fork
2.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo l’esempio CameraXTfLite sul Moto G5 e analizza il percorso CameraDetector$getAnalyzer insieme ai log segnalati di heap, GPU e allocazione dei thread. Verifica se le risorse della fotocamera, dell’analyzer o delle immagini si accumulano durante un’esecuzione di 20–25 minuti; il lavoro è completato quando l’esempio non raggiunge più il crash Out-of-Memory segnalato sul dispositivo interessato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
kotlin
Ambito
computer-vision, mobile
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.