I have the following native routine:
void sendMessage(const char* text)
{
JNIEnv* env;
if(!_jvm)
return;
_jvm->AttachCurrentThread(&env, NULL);
if(!_nativesCls)
_nativesCls = env->FindClass("com/foo/BaseLib");
if(_nativesCls == 0)
return;
jstring message = env->NewStringUTF(text);
if(!_sendStr)
_sendStr = env->GetStaticMethodID(_nativesCls, "onMessage", "(Ljava/lang/String;)V");
if(_sendStr)
env->CallStaticVoidMethod(_nativesCls, _sendStr, message);
}
If I run it as it is, it works fine until the memory is full, and I get:
ReferenceTable overflow (max = 512)
I thought adding the comment line above would fix the problem, but it just makes the application bomb at that moment.
Any suggestions?
source
share