KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following problem, from c++ I send huge string[] to java. huge = at most 20 rows; I am doing the following jint jtype = 2; jstring emptyString = env->NewStringUTF(""); jobjectArray data = (jobjectArray)env->NewObjectArray(7, env->FindClass("java/lang/String"), emptyString); env->SetObjectArrayElement( data,0,env->NewStringUTF(item->get_id().c_str()); env->SetObjectArrayElement( data,1,env->NewStringUTF(item->get_number().c_str()); env->SetObjectArrayElement( data,2,env->NewStringUTF(item->get_fullname().c_str()); env->SetObjectArrayElement( data,3,env->NewStringUTF(item->get_mf().c_str()); env->SetObjectArrayElement( data,4,env->NewStringUTF(item->get_dob().c_str()); env->CallVoidMethod(dao, jsaveItem, data, jtype); int i; for (i = 0; i < 5; ++i) { jstring string = (jstring) env->GetObjectArrayElement(data, i); env->DeleteLocalRef(string); } env->DeleteLocalRef(emptyString); env->DeleteLocalRef(data); env->DeleteLocalRef(dao); this is happening in a loop so I am doing it for every object I want to save in the database, so as you can imagine, it happends lots of times. So I am considerate of the VM and delete the local refs of every string I create, but still I get : ReferenceTable overflow (max=512) Last 10 entries in JNI local reference table: 502: 0x40552880 cls=Ljava/lang/String; (28 bytes) 503: 0x405528b8 cls=Ljava/lang/String; (28 bytes) 504: 0x4051f8d0 cls=Ljava/lang/Class; 'Lcom/project/storage/userdata/DataDao;' (212 bytes) 505: 0x4052eb38 cls=Lcom/project/storage/userdata/DataDao; (12 bytes) 506: 0x4051f8d0 cls=Ljava/lang/Class; 'Lcom/project/storage/userdata/DataDao;' (212 bytes) 507: 0x4052eb38 cls=Lcom/project/storage/userdata/DataDao; (12 bytes) 508: 0x4051f8d0 cls=Ljava/lang/Class; 'Lcom/project/storage/userdata/DataDao;' (212 bytes) 509: 0x4052eb38 cls=Lcom/project/storage/userda
Tags (comma-separated)
Save Edits
Cancel