Native calls and 16-slot local reference limit

19 views
Skip to first unread message

scgames2

unread,
May 26, 2020, 10:54:41 AM5/26/20
to android-ndk
According to documentation here and elsewhere, upon entering a native function JNI guarantees that 16 local reference slots are available. Android seems to provide much more than that, and I'm aware there are functions such as PushLocalFrame() available, but it's specifically the guaranteed minimum I'm interested in.

My question is, do reference arguments to native functions (the object/class argument, and any other arguments of object type) count against those 16 slots? For example, if a native function takes the usual object/class argument and a jstring argument, do you then only have 14 slots available?

My assumption is that function arguments don't count against the minimum. Almost all evidence I've seen seems to support that, as does a common-sense reading of the documentation, but I've also seen some sources that seem vague on this point, so I'd like to confirm it if possible.

Are function arguments counted against the 16 slots? Or are you guaranteed 16 slots irrespective of the function arguments?

Dan Albert

unread,
May 26, 2020, 11:24:08 AM5/26/20
to android-ndk, Elliott Hughes
+enh

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/289a202a-f6ea-4ac3-9c37-9715e613893e%40googlegroups.com.

enh

unread,
May 26, 2020, 11:29:28 AM5/26/20
to Dan Albert, Nicolas Geoffray, android-ndk
+Nicolas Geoffray because that code's probably been rewritten twice
since i last touched it!
Reply all
Reply to author
Forward
0 new messages