我有一个大约15个主题的应用程序。大多数人做平凡的任务,大部分时间都在睡觉。其他人收集信息并将其缓存在哈希映射中。散列图增长到适中的大小并逐渐消失。键的数量和值的大小保持不变,但值的内容会发生变化(平均每秒33键)。
当我启动我的应用程序时,我注意到垃圾收集时间间隔从几分钟到每秒一次,每次垃圾量为700k +。
事实上,当我写这篇文章时,它导致我的手机重启,出现“Referencetable Overflow”错误。
这是我的问题:是否有任何技巧来识别哪些线程产生垃圾,甚至找到更多关于它们产生什么垃圾的技巧?
05-26 22:08:57.052 W/dalvikvm( 1031): ReferenceTable overflow (max=512)
05-26 22:08:57.052 W/dalvikvm( 1031): Last 10 entries in JNI local reference table:
05-26 22:08:57.052 W/dalvikvm( 1031): 502: 0x449904a8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 503: 0x4494fda8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 504: 0x44a172c8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 505: 0x448c7900 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 506: 0x44842b18 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 507: 0x448e9eb8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 508: 0x449c6ae0 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 509: 0x44998138 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 510: 0x44961ae0 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 511: 0x448ee470 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.060 W/dalvikvm( 1031): JNI local reference table summary (512 entries):
05-26 22:08:57.060 W/dalvikvm( 1031): 487 of Ljava/lang/String; 28B (487 unique)
05-26 22:08:57.060 W/dalvikvm( 1031): 25 of Ljava/lang/String; 36B (25 unique)
05-26 22:08:57.060 W/dalvikvm( 1031): Memory held directly by native code is 14536 bytes
05-26 22:08:57.068 E/dalvikvm( 1031): Failed adding to JNI local ref table (has 512 entries)
05-26 22:08:57.068 I/dalvikvm( 1031): "BT EventLoop" prio=5 tid=81 RUNNABLE
05-26 22:08:57.068 I/dalvikvm( 1031): | group="main" sCount=0 dsCount=0 s=N obj=0x447cd620 self=0x4d7b38
05-26 22:08:57.068 I/dalvikvm( 1031): | sysTid=1138 nice=0 sched=0/0 cgrp=default handle=4210840
05-26 22:08:57.068 I/dalvikvm( 1031): at dalvik.system.NativeStart.run(Native Method)
05-26 22:08:57.068 I/dalvikvm( 1031):
05-26 22:08:57.068 E/dalvikvm( 1031): VM aborting
05-26 22:08:57.185 I/DEBUG ( 990): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***