IBM User Guide for Java V7 on Windows > IBM SDK for Java > The Java Native Interface (JNI)



JNI checklist

There are a number of items that you must remember when using the JNI.

The following table shows the JNI checklist:

Remember Outcome of nonadherence
Local references cannot be saved in global variables. Random crashes (depending on what you pick up in the overwritten object space) happen at random intervals.
Ensure that every global reference created has a path that deletes that global reference. Memory leak. It might throw a native exception if the global reference storage overflows. It can be difficult to isolate.
Always check for exceptions (or return codes) on return from a JNI function. Always handle a deferred exception immediately you detect it. Unexplained exceptions or undefined behavior. Might crash the JVM.
Ensure that array and string elements are always freed. A small memory leak. It might fragment the heap and cause other problems to occur first.
Ensure that you use the isCopy and mode flags correctly. See A generic way to use the isCopy and mode flags. Memory leaks, heap fragmentation, or both.
When you update a Java™ object in native code, ensure synchronization of access. Memory corruption.


Parent: The Java Native Interface (JNI)








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.