RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 407 forks source link

Memory Leak when updateConfiguration() #346

Closed mym0404 closed 6 months ago

mym0404 commented 5 years ago

When is use updateConfiguration for turn flash mode (torch(), off())

addFrameWithBuffer() method made memory leak.

and i recognized that

start() method is called 3~4 times at once.

So I just changed some code like below.

fun updateProcessorSafely(frameProcessor: FrameProcessor?) {
        if(!frameProcessors.isEmpty())
            return
        clearProcessors()
        if (frameProcessor == null) {
            stop()
        } else {
            addProcessor(frameProcessor)
            start()
        }
    }

Sorry about ugly preview. I am newbie on Github.

I use single same frame processor, so i have no reason to update processor at updateConfiguartion() call

army650663 commented 4 years ago

Same problem!