weak global reference table overflow (max=51200)

最近有测试上报一个app native crash的问题

10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422] Runtime aborting...
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422] Aborting thread:
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422] "main" prio=10 tid=1 Runnable
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   | group="" sCount=0 dsCount=0 obj=0x74a4ca10 self=0x7f9de96a00
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   | sysTid=18664 nice=-10 cgrp=default sched=0/0 handle=0x7fa235ca98
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   | state=R schedstat=( 262225852602 34182387833 226882 ) utm=23461 stm=2761 core=6 HZ=100
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   | stack=0x7fc4d51000-0x7fc4d53000 stackSize=8MB
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   | held mutexes= "abort lock" "JNI weak global reference table lock" "mutator lock"(shared held)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #00 pc 00000000004cb014  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #01 pc 00000000004cb010  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #02 pc 000000000049dfe0  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+480)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #03 pc 000000000048b358  /system/lib64/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+56)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #04 pc 000000000048b15c  /system/lib64/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+608)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #05 pc 000000000047e2e0  /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+148)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #06 pc 00000000000e74e4  /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+1320)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #07 pc 0000000000273f44  /system/lib64/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+324)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #08 pc 00000000003255c0  /system/lib64/libart.so (_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadEPNS_6mirror6ObjectE+76)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #09 pc 000000000038942c  /system/lib64/libart.so (_ZN3art3JNI16NewWeakGlobalRefEP7_JNIEnvP8_jobject+604)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #10 pc 00000000000e2310  /system/lib64/libandroid_runtime.so (???)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   native: #11 pc 0000000000c51efc  /system/framework/arm64/boot-framework.oat (Java_android_view_RenderNode_nCreate__Ljava_lang_String_2+152)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   at android.view.RenderNode.nCreate(Native method)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   at android.view.RenderNode.<init>(RenderNode.java:137)
10-04 01:00:00.580 18664 18664 F art     : art/runtime/runtime.cc:422]   at android.view.RenderNode.create(RenderNode.java:161)
从调用堆栈看,一串的libart.so,明显的虚拟机异常退出。再看堆栈中最后的java代码到C++代码的jni方法是RendorNode.nCreate。那么大概也可以推测出这是内存泄漏的问题。实际上log中也打印了jni异常的具体信息

10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132] JNI ERROR (app bug): weak global reference table overflow (max=51200)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132] weak global reference table dump:
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]   Last 10 entries (of 51200):
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51199: 0x39e05670 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51198: 0x39e05628 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51197: 0x39e055c8 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51196: 0x39e05580 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51195: 0x39e05538 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51194: 0x39e05460 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51193: 0x39e05418 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51192: 0x39e053d0 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51191: 0x39e05370 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     51190: 0x39e05310 android.view.RenderNode
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]   Summary:
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (432 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         3 of byte[] (1440 elements) (3 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (2916 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (3864 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         3 of byte[] (3888 elements) (3 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         3 of byte[] (5016 elements) (3 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (5184 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]        10 of byte[] (6400 elements) (10 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (6912 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (8192 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         5 of byte[] (9216 elements) (5 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]       187 of byte[] (9400 elements) (187 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         4 of byte[] (10080 elements) (4 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (10792 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]       187 of byte[] (11024 elements) (187 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (12960 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]       480 of byte[] (14400 elements) (480 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (17280 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (18360 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (19600 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]        14 of byte[] (20736 elements) (14 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (23716 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]        27 of byte[] (26244 elements) (27 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         2 of byte[] (34848 elements) (2 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         2 of byte[] (35344 elements) (2 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]        15 of byte[] (36864 elements) (15 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         3 of byte[] (46656 elements) (3 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         2 of byte[] (47808 elements) (2 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         3 of byte[] (79488 elements) (3 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         5 of byte[] (82944 elements) (5 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (99360 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         4 of byte[] (108000 elements) (4 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (135424 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (147456 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (167072 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         1 of byte[] (167808 elements)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         5 of byte[] (270400 elements) (5 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         2 of byte[] (518400 elements) (2 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]         7 of dalvik.system.PathClassLoader (4 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]        23 of java.lang.DexCache (23 unique instances)
10-04 01:00:00.222 18664 18664 F art     : art/runtime/indirect_reference_table.cc:132]     50187 of android.view.RenderNode (50187 unique instances)
weak global reference table引用数超出最大限制,51200中居然有50187个view相关对象。

具体模块要查内存泄漏的根源。





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值