我正在使用netbeans使用java进行文本分类的应用程序,以及为什么它需要更多的内存,它大约是6 GB的内存

时间:2015-12-27 08:17:08

标签: java csv netbeans weka

如何在Java中释放内存?我使用system.gc,但它仍然占用大量内存,当应用程序在csv中写入其增加并且每个csv大约需要0.6gb时,dokumen包含1000 ArrayList

try (FileWriter out = new FileWriter(new File("hasil\\hasil_binary" + s + ".csv"))) {
            out.write("dokumen_data");
            for (int i = 0; i < kamus.size(); i++) {
                out.write("," + kamus.get(i));
            }
            out.write("," + "Class");
            out.write("\n");
            for (int i = 0; i < dokumen.size(); i++) {
                out.write("dokumen_" + i);
                for (int j = 0; j < dokumen.get(i).nt.size(); j++) {
                    out.write("," + dokumen.get(i).nt.get(j).getBinary());
                }
                out.write("," + dokumen.get(i).kategori);
                out.write("\n");
            }
            out.close();
        }
        writer.flush();
        writer.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

0 个答案:

没有答案