newLocalRef

context(env: JniEnv)
fun <T : JRef<O>, O : _jobject> T.newLocalRef(): T?(source)

Creates and returns a new local reference that refers to the same object. The receiver may be a global or a local reference.

May return null if:

  • the system has run out of memory

  • the receiver was a weak global reference and has already been garbage collected.

Throws

if the system runs out of memory.