首页 > 解决方案 > 处理记录所需的堆内存大小

问题描述

我正在处理具有 100 万条记录的数据。我已将堆内存从 -xmas 256m 增加到 -xmas 512m 和 -xmax 1024m 到 -xmax 2048m。仍然出现内存不足错误如下:

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java 
heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at java.io.StringWriter.write(Unknown Source)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1129)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1104)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1050)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:359)
at WorkSpot.Ftp.getmfebcdata(Ftp.java:372)
at WorkSpot.ParseData.parsetolines(ParseData.java:112)
at WorkSpot.SheetFormat.getsheet(SheetFormat.java:55)
at WorkSpot.MainScreen$1.actionPerformed(MainScreen.java:492)
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.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.dispatchEventImpl(Unknown Source)

请帮我解决这个问题。

标签: eclipseheap-memory

解决方案


The eclipse.ini settings change the memory used by Eclipse itself, they do not change the memory settings of programs you run from inside Eclipse. It is rare to need to change this file.

To change the settings for your program open the 'Run > Run Configurations' dialog.

Find your program configuration in the Java Applications section.

On the 'Arguments' tab put the -Xms and -Xmx settings in the 'VM Arguments' section.


推荐阅读