尝试使用hashtable大数据时遇到问题。我有一个包含超过 111000 条记录的文本文件,当它达到 75000 条时,抛出了内存不足异常,那么有人对此有任何解决方案吗?
问题发生在以下行:
while ((text = reader.readLine())!= null);
并且由于  java.lang.String <init>内部readLine(),但我认为问题来自hashtable太大而无法保存存储数据。
我在我的xperia Neo上对其进行了测试,但它失败了,尽管它在另一台三星设备上运行得很好。
SoundUnit我保留的对象hashtable具有以下结构:
private String filename; 
private int start; 
private int end;
就在 SoundUnit 对象内的 3 个字段之上。
这是我用来从文本中读取数据以存储的一段代码hashtable:
       reader = new BufferedReader(new InputStreamReader(new FileInputStream(unitSelectionFile),  "UTF-8"));
       String text=null;
       do {
                if (text.length() != 0) {
                    if (mainHash.get(text)==null)
                        mainHash.put(key, soundUnit);
                }
        } while ((text = reader.readLine())!= null);