如何解决Java堆空间错误

时间:2014-03-05 06:48:19

标签: java heap-memory

我试图在oracle中通过ETL插入1.30 GB数据。但是我在线程中获得了异常" pool-1-thread-1" java.lang.OutOfMemoryError:Java堆空间错误。这是我的例外树

Wed Mar 05 12:07:18 IST 2014 Starting data-source : Hua_GPRS_CS5_4.7

Wed Mar 05 12:07:18 IST 2014 Fetching Files @ ./data/huagprs/source

Processing next 20 files from ./data/huagprs/source
Processing file:        D:\workspace\TestHardNess\data\huagprs\source\LEPC18_b00326794.dat_140110.100308_7518.Z
 Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:2694)
at java.lang.String.<init>(String.java:203)
at java.lang.StringBuilder.toString(StringBuilder.java:405)
at jayu.ASCIIFormattable.byteArr2TimeStamp(ASCIIFormattable.java:173)
at hua.gprs.HuawieGPRS.getValue(HuawieGPRS.java:122)
at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:37)
at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:60)
at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:47)
at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:60)
at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:30)
at hua.gprs.HuawieGPRSParser.persefile(HuawieGPRSParser.java:123)
at hua.gprs.HuaGPRSFileExecutor.processFile(HuaGPRSFileExecutor.java:16)
at com.etl.FileExecutor.run(FileExecutor.java:166)
at com.etl.JobManager.executeFiles(JobManager.java:113)
at com.etl.JobManager.crawlDir(JobManager.java:196)
at com.etl.JobManager.run(JobManager.java:83)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

eclipse ini配置

-startup
    plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
   --launcher.library
   plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
  -product
  org.eclipse.epp.package.jee.product
   --launcher.defaultAction
    openFile
   --launcher.XXMaxPermSize
   256M
  -showsplash
  org.eclipse.platform
   --launcher.XXMaxPermSize
   256m
  --launcher.defaultAction
  openFile
  -vmargs
  -Dosgi.requiredJavaVersion=1.5
   -Dhelp.lucene.tokenizer=standard
  -Xms40m
  -Xmx512m

1 个答案:

答案 0 :(得分:0)

尝试增加-Xms和-Xmx参数。你可以像这样使用sthg;

--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m