Exception occurred during event dispatching:
java.lang.OutOfMemoryError: Java heap space
at Utility.Matrix.<init>(Matrix.java:22)
at Utility.Matrix.times(Matrix.java:402)
at Utility.Matrix.vectorMultiplyMatrix(Matrix.java:224)
at LatentSemanticAnalysis.Models.modelTraining(Models.java:92)
at DesktopInterface.Setting.jButton4ActionPerformed(Setting.java:397)
at DesktopInterface.Setting.access$3(Setting.java:391)
at DesktopInterface.Setting$4.actionPerformed(Setting.java:108)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
是程序运算量太大,内存不够用吗?用另外一组数据时,可以通过。换了一组量相对比较大的数据,就出现上面的错误了。求达人指点。

解决方案 »

  1.   

    要是确定算法没有死循环,就先加大堆空间试试吧
    在命令行中,启动参数中增加 -Xmx1024m 就是分配1G了。
     关于JVM内存参数,网上有非常非常非常非常多的资料
      

  2.   

    太假了吧。程序在Eclipse上运行出现上面的错误,在Netbeans上运行,ok!
      

  3.   

    在没有增加堆内存空间的情况下,程序在Eclipse上运行出现上面的错误,在Netbeans上运行,ok通过了!这也太假了吧?!这是什么原因呢?
      

  4.   

    有可能是Eclipse和Netbeans的缺省JVM参数不一致。可以把系统变量打印出来,或者用Java console连上去看看具体的参数配置确认一下
      

  5.   

    netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true --fontsize 13 -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true "--launcher.XXMaxPermSize
    256m
    -vmargs
    -Xverify:none
    -Xms40m
    -Xmx256m???