Skip to content

Pipeline leaks a lot of threads #14459

@distinctdan

Description

@distinctdan

I'm building an android app where streaming can be stopped and started repeatedly. However, I've discovered that Pipeline appears to be leaking a lot of threads after stop() is called, like 7 or 8 threads. I know android isn't officially supported, but this appears to be a bug in the native side since the android classes are just thin wrappers. Am I missing something here that I'm supposed to be cleaning up?

In this example, I'm starting and stopping the pipeline in a loop every couple of seconds to demonstrate the memory growth:

SDK version is 2.56.5

while(true) {
    delay(5000)
    
    val thread = Thread {
        val config = Config()
        config.use {
            config.disableAllStreams()
            config.enableStream(StreamType.COLOR, -1, STREAM_WIDTH, STREAM_HEIGHT, StreamFormat.ANY, 6)

            val pipeline = Pipeline()
            pipeline.use {
                pipeline.start(config)
                Thread.sleep(1000)
                pipeline.stop()
            }
        }
    }
    thread.start()
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions