refFrame

context(env: JniEnv)
inline fun <T> refFrame(capacity: Int, block: () -> T): T(source)

Executes the block in a new local reference frame, in which at least a given number of local references can be created. Then pops the frame, freeing all the local references and returns the result of block.

Note that local references already created in previous local frames are still valid in the current local frame.

Some Java Virtual Machine implementations may choose to limit the maximum capacity, which may cause the function to throw an exception.

Return

the result of block. You should not return any local reference as it will be invalid at this point. To return local refence, use fromRefFrame.

Since

JDK/JRE 1.2

Parameters

capacity

the minimum number of required local references. Must be > 0.

block

the block to execute in the local reference frame.