Finalize alternative in kotlin native?


#1

Hi,

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.

Cheers,

Rien


#2

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.