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