W/dalvikvm(1214): ReferenceTable overflow (max=512)

LogCat输出信息如下:
=================================================================================
W/dalvikvm(1214): ReferenceTable overflow (max=512)
W/dalvikvm(1214): Last 10 entries in JNI local reference table:
W/dalvikvm(1214): 502: 0x4050bed0 cls=L android/graphics/Point; (20 bytes)
W/dalvikvm(1214): 503: 0x4050bee8 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 504: 0x4050bf00 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 505: 0x4050bf18 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 506: 0x4050bf30 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 507: 0x4050bf48 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 508: 0x4050bf60 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 509: 0x4050bf78 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 510: 0x4050bf90 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): 511: 0x4050bfa8 cls=Landroid/graphics/Point; (20 bytes)
W/dalvikvm(1214): JNI local reference table summary (512 entries):
W/dalvikvm(1214): 1 of Ljava/lang/Class; 164B
W/dalvikvm(1214): 1 of Ljava/lang/Class; 212B
W/dalvikvm(1214): 1 of Ljava/lang/Class; 236B
W/dalvikvm(1214): 1 of Ljava/lang/Class; 284B
W/dalvikvm(1214): 1 of Ljava/lang/Class; 476B
W/dalvikvm(1214): 1 of Ljava/lang/Class; 572B
W/dalvikvm(1214): 2 of Ljava/lang/String; 28B (2 unique)
W/dalvikvm(1214): 1 of [Ljava/lang/String; 28B
W/dalvikvm(1214): 502 of Landroid/graphics/Point; 20B (502 unique)
W/dalvikvm(1214): 1 of Landroid/graphics/Point; 28B
W/dalvikvm(1214): Memory held directly by tracked refs is 12096 bytes
E/dalvikvm(1214): Failed adding to JNI local ref table (has 512 entries)
=================================================================================
错误描述:
JNI中通过java传过来的点的集合的对象创建C++点集合的对象,其中一段代码如下:
--------------------------------------------------
jclass objclass = env->GetObjectClass(objPoint);

jfieldID id = env->GetFieldID(objclass, ..., ...);
point.x = env->GetIntField(objPoint, id);

id = env->GetFieldID(objclass, ..., ...);
point.y = env->GetIntField(objPoint, id);
--------------------------------------------------
这样循环可以创建251个点,但是到第252次调用上述代码的时候又出现最上面的错误。
在网上查了一下,return前加入一句:
env->DeleteLocalRef(objclass);


















你可能感兴趣的:(reference)