eclipse - 处理记录所需的堆内存大小
问题描述
我正在处理具有 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)
请帮我解决这个问题。
解决方案
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.
推荐阅读
- css - 如何在 CSS 中选择此元素?
- flutter - ListView 在列表顶部时与元素重叠
- c# - 为什么在遍历字典的项目并修改它们的值时需要临时将键保存到列表中?
- php - PHP、PDO 和 MySQL - 返回的查询顺序不正确
- intellij-idea - 只有返回语句的 Kotlin lambda 函数
- php - 无法从本地托管的网页将表单发布到本地 mysql 服务器
- python - 艰难地学习 Python ex35 Bear Room
- reactjs - React 和 Serviceworker (Workbox)
- javascript - 如何将数据发布到api
- angular - 当移动键盘以角度 5 弹出时,模态输入不会滚动到焦点上的输入字段