In the JNI document, GetStringUTFChars(), which converts a java string jstring
to c++ const char*
, will return an optional jboolean
flag indicating whether it performs copy or not within the function call. However, the document does not mention when GetStringUTFChars() will or will not perform copy. My questions are:
- Under which condition GetStringUTFChars() will perform a copy?
- Is there any way to avoid copy in GetStringUTFChars()?
- If the answer to question 2. is true, is it suggested to avoid such copy?