Skip to main content

skip to main content

developerWorks  >  Java technology  >

Gems from e-BIT: JNI Get* calls

developerWorks
Document options

Document options requiring JavaScript are not displayed


Rate this page

Help us improve this content


Level: Introductory

Mark Bluemel (dwinfo@us.ibm.com), Software engineer, IBM Hursley Lab

15 Jan 2002

JNI programmers who use Get* calls (for example, GetStringCritical) must always use the corresponding Release* call (for example, ReleaseStringCritical) when they have finished with the data -- even if the isCopy parameter indicates that no copy was taken.

The Get* calls must guarantee that the pointer returned remains valid until Release* is called, so the JVM will either hold additional copies of the data or "pin" the data, so it can neither be garbage collected nor moved during heap compaction. This will cause subsequent heap problems.

Use -Xcheck:jni, which enables argument checking for JNI interface routines. By default, no "sanity-checking" of JNI arguments is done.



About the author

Mark Bluemel is a software engineer at the IBM Hursley Lab.




Rate this page


Please take a moment to complete this form to help us better serve you.



 


 


Not
useful
Extremely
useful
 


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!



Back to top