Finalize alternative in kotlin native?


Is there a finalize alternative in kotlin native? I would like to be able to clean up some manual memory allocation when an object is freed by the reference counter.



1 Like

Not AFAIK but see this SO post from @Nikolay.Igotti showing how you could use an inline lambda to create a ‘memScoped’ equivalent for a Kotlin object which holds a reference to a native resource.

1 Like