IBM User Guide for Java V7 on Windows > IBM SDK for Java > The Java Native Interface (JNI) > The JNI and the Garbage Collector > JNI transitions
J2N calls
The JVM must ensure that objects passed as parameters from Java™ to the native method and any new objects created by the native code remain reachable by the GC. To handle the GC requirements, the JVM allocates a small region of specialized storage called a local reference root set.
A local reference root set is created when:
- A thread is first attached to the JVM (the outermost root set of the thread).
- Each J2N transition occurs.
The JVM initializes the root set created for a J2N transition with:
- A local reference to the caller's object or class.
- A local reference to each object passed as a parameter to the native method.
New local references created in native code are added to this J2N root set, unless you create a new local frame using the PushLocalFrame JNI function.
The default root set is large enough to contain 16 local references per J2N transition. The -Xcheck:jni command-line option causes the JVM to monitor JNI usage. When -Xcheck:jni is used, the JVM writes a warning message when more than 16 local references are required at run time. If you receive this warning message, use one of the following JNI functions to manage local references more explicitly:
- NewLocalRef
- DeleteLocalRef
- PushLocalFrame
- PopLocalFrame
- EnsureLocalCapacity
Parent: JNI transitions
Error 404 - Not Found Error 404 - Not Found
The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.