Package kotlin.native.ref

Types

Native
1.9

Cleaner

The marker interface for objects that have a cleanup action associated with them.

sealed interface Cleaner
Native
1.3

WeakReference

Class WeakReference encapsulates weak reference to an object, which could be used to either retrieve a strong reference to an object, or return null, if object was already destroyed by the memory manager.

class WeakReference<T : Any>

Functions

Native
1.9

createCleaner

Creates a Cleaner object that runs cleanupAction with given resource some time after its deallocation.

fun <T> createCleaner(
    resource: T,
    cleanupAction: (resource: T) -> Unit
): Cleaner