我显示了很多图片出现了Exception in thread "Image Fetcher 3" java.lang.OutOfMemoryError: Jav

zaishiyuxia 2009-09-13 05:19:39
由于我加了10张图片 是一个jcombobox
就是选中哪一个 就显示哪张图片
但是图片数量太多出现了
Exception in thread "Image Fetcher 3" 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 sun.awt.image.ImageRepresentation.createBufferedImage(Unknown Source)
at sun.awt.image.ImageRepresentation.setPixels(Unknown Source)
at sun.awt.image.ImageDecoder.setPixels(Unknown Source)
at sun.awt.image.JPEGImageDecoder.sendPixels(Unknown Source)
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at sun.awt.image.JPEGImageDecoder.produceImage(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
Exception in thread "Image Fetcher 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 sun.awt.image.ImageRepresentation.createBufferedImage(Unknown Source)
at sun.awt.image.ImageRepresentation.setPixels(Unknown Source)
at sun.awt.image.ImageDecoder.setPixels(Unknown Source)
at sun.awt.image.PNGImageDecoder.sendPixels(Unknown Source)
at sun.awt.image.PNGImageDecoder.produceImage(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
求解决办法
...全文
580 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
铁匠梁老师 2009-09-13
  • 打赏
  • 举报
回复
要治本,先看代码有无内存泄露,在说升级内存的问题。
config_man 2009-09-13
  • 打赏
  • 举报
回复
在catalia.bat文件中添加下面一句:set Java_OPTs = Xmx512m Xms512m

修改这个东东试试
  • 打赏
  • 举报
回复
http://blog.163.com/canni3268/blog/static/3069220620081124111357617/

上面的帖子是处理JVM不足的各种方法,
我还是头次遇到这个问题
学习了
zaishiyuxia 2009-09-13
  • 打赏
  • 举报
回复
请问能具体说下怎么加大内存吗。。-Xmx1024 指定1024M 这个输入在哪里呢。。?
老紫竹 2009-09-13
  • 打赏
  • 举报
回复
1 增大jvm的内存
-Xmx1024 指定1024M

2 如果是内存泄露,那么增加跟多的内存只是延长时间而已。

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧