Memoryleaks when using kotlin classes inside c

21 Views Asked by At

I am working on a kotlin multiplatform framework that can be used on android an linux (with native c interop.

Both worlds shared classes, that are part of the commonMain.

For example I have this worker class in commonMain:

public class MyWorker(val data: List<JsonData>) {
    private var labels : List<String> = data.map { /*some mapping*/ }
    private val regexPatterns = PatternCreator().createPatterns(data)
}

The MyWorker class produces a lot of data. When I call the framework from C, I get a lot of memory leaks because the memory inside the MyWorker class is not cleared.

Can someone explain how to free the used memory?

Thank you

0

There are 0 best solutions below