java設定虛擬記憶體問題

來源:互聯網
上載者:User

 利用java編寫程式,訪問kddcup99資料集,採用如下代碼獲得Instances,

 public static  Instances  getArffFile(String FileName)throws Exception
    {
       DataSource source= new DataSource(FileName);
       Instances ins = source.getDataSet();

     if(ins.classIndex()==-1)
        ins.setClassIndex(ins.numAttributes()-1);//這一句一定不要少
          //System.out.println("\n"+FileName+"資料集讀取完畢,總共樣本個數是:"+ins.numInstances()+"個!\n");    
      return ins;
    }

結果提示如下:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
 at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
 at java.lang.Double.valueOf(Unknown Source)
 at weka.core.converters.ArffLoader$ArffReader.getInstanceFull(Unknown Source)
 at weka.core.converters.ArffLoader$ArffReader.getInstance(Unknown Source)
 at weka.core.converters.ArffLoader$ArffReader.readInstance(Unknown Source)
 at weka.core.converters.ArffLoader$ArffReader.readInstance(Unknown Source)
 at weka.core.converters.ArffLoader.getDataSet(Unknown Source)
 at weka.core.converters.ConverterUtils$DataSource.getDataSet(Unknown Source)
 at conceptDrift.detection.method.read_copy_arff.getArffFile(read_copy_arff.java:24)
 at conceptDrift.detection.method.read_copy_arff.main(read_copy_arff.java:35)

 

於是去修改 eclipse.ini的-Xmx 256m  為 -Xmx1024m ,雙擊eclipse.exe 提示

但改為-Xmx512,則能順利開啟eclipse.exe.不知道是怎麼回事?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.