由properties.load()引起的引用表溢出;

时间:2013-04-24 09:00:14

标签: android properties overflow logcat fileinputstream

这是我的LogCat:

04-24 10:51:42.384: W/dalvikvm(30752): ReferenceTable overflow (max=1024)
04-24 10:51:42.384: W/dalvikvm(30752): JNI pinned array reference table (0x5c75b170) dump:
04-24 10:51:42.384: W/dalvikvm(30752):   Last 10 entries (of 1024):
04-24 10:51:42.384: W/dalvikvm(30752):      1023: 0x42836b48 byte[] (1 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1022: 0x430b65b8 byte[] (8192 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1021: 0x426f93e8 byte[] (1 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1020: 0x430421b0 byte[] (8192 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1019: 0x42713fa0 byte[] (1 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1018: 0x430ae558 byte[] (8192 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1017: 0x42798e88 byte[] (1 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1016: 0x430a64f8 byte[] (8192 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1015: 0x42e6bce0 byte[] (1 elements)
04-24 10:51:42.384: W/dalvikvm(30752):      1014: 0x43092438 byte[] (8192 elements)
04-24 10:51:42.384: W/dalvikvm(30752):   Summary:
04-24 10:51:42.384: W/dalvikvm(30752):       515 of byte[] (1 elements) (515 unique instances)
04-24 10:51:42.384: W/dalvikvm(30752):       509 of byte[] (8192 elements) (509 unique instances)
04-24 10:51:42.384: E/dalvikvm(30752): Failed adding to JNI pinned array ref table (1024 entries)
04-24 10:51:42.384: I/dalvikvm(30752): "Thread-2836" prio=5 tid=1036 RUNNABLE
04-24 10:51:42.384: I/dalvikvm(30752):   | group="main" sCount=0 dsCount=0 obj=0x42773468 self=0x9da32660
04-24 10:51:42.384: I/dalvikvm(30752):   | sysTid=850 nice=0 sched=0/0 cgrp=apps handle=-1650356024
04-24 10:51:42.384: I/dalvikvm(30752):   | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
04-24 10:51:42.384: I/dalvikvm(30752):   at libcore.io.Posix.recvfromBytes(Native Method)
04-24 10:51:42.384: I/dalvikvm(30752):   at libcore.io.Posix.recvfrom(Posix.java:131)
04-24 10:51:42.384: I/dalvikvm(30752):   at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
04-24 10:51:42.384: I/dalvikvm(30752):   at libcore.io.IoBridge.recvfrom(IoBridge.java:513)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.io.DataInputStream.read(DataInputStream.java:84)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.io.BufferedInputStream.read(BufferedInputStream.java:304)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.io.InputStream.read(InputStream.java:163)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.io.BufferedInputStream.read(BufferedInputStream.java:309)
04-24 10:51:42.394: I/dalvikvm(30752):   at java.io.InputStream.read(InputStream.java:163)
04-24 10:51:42.394: I/dalvikvm(30752):   at com.bowltec.network.Reader1$1.run(Reader1.java:28)
04-24 10:51:42.394: E/dalvikvm(30752): VM aborting
04-24 10:51:42.394: A/libc(30752): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 850 (Thread-2836)

这里是我的代码,这个LogCat属于:

public static int cfgget(String tocollect) throws IOException {

    FileInputStream fis = context.openFileInput(cfg);
    props.load(fis);
    fis.close();

    if (props.containsKey(tocollect)) {
        String collected = props.getProperty(tocollect, "0");
        coll = Integer.valueOf(collected);
        return coll;
    } else {
        return 0;

    }
}

此片段至少每秒调用一次,大约5-6分钟后,我的应用程序与上面显示的LogCat崩溃。有谁可以帮我理解它的意思并解决这个问题?

1 个答案:

答案 0 :(得分:0)

此错误属于我使用的线程。如果你打开1024个线程,但是你忘了以任何方式阻止它们,你就会得到这个。