线程"AWT-EventQueue-0"中的异常; java.lang.OutOfMemoryError:Java堆空间 [英] Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
问题描述
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.<init>(Unknown Source)
at java.awt.image.Raster.createPackedRaster(Unknown Source)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.awt.image.BufferedImage.<init>(Unknown Source)
at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)
at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)
at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
从生产环境加载Web启动应用程序时,我收到此错误消息. 当我从eclipse加载相同的生产代码时,以上错误"java.lang.OutOfMemoryError:Java堆空间"消失了,一切正常. 是什么原因,为什么它可以在Eclipse中运行而不是独立运行?
Iam getting this error message when I load the Web start application from production. When I load the same production code from eclipse, the above error "java.lang.OutOfMemoryError: Java heap space" disappear and everything works fine. What could the reason, why it is working in eclipse and not in standalone.
-Pad
推荐答案
Java的默认堆大小(至少是我上次研究的时间)为128 MB. Eclipse的最新版本(即Helios)设置为以512 MB的默认堆大小运行. (请参阅Eclipse基本路径中的eclipse.ini
文件).
Java's default heap size (at least last time I researched it) is 128 MB. The latest version of Eclipse (i.e. Helios) is set to run with a default heap size of 512 MB. (see the eclipse.ini
file in your Eclipse base path).
因此,您可能会看到此行为,因为您的应用程序需要的堆大小大于128 MB ...这不是从系统JVM的默认值中获得的,而是在Eclipse JVM进程中获得的.
Therefore, you are probably seeing this behavior because your application needs a heap size greater than 128 MB... which it doesn't get from your system JVM's defaults, but DOES get within the Eclipse JVM process.
在Web Start的".jnlp"文件中,查找第一个<j2se>
元素,然后添加一个max-heap-size
属性,如下所示:
In your Web Start ".jnlp" file, look for the first <j2se>
element, and add a max-heap-size
attribute like this:
<j2se version="1.3" initial-heap-size="256m" max-heap-size="512m"/>
参考
http://download.oracle. com/javase/1.5.0/docs/guide/javaws/developersguide/syntax.html
这篇关于线程"AWT-EventQueue-0"中的异常; java.lang.OutOfMemoryError:Java堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!