[問題]監視畫面程式-outOfMemory問題~~
小妹已經爬過之前OutOfMemory的文了
但依舊沒獲得需要的解答 因此希望板上各位大大可以幫忙解惑~
小妹正在寫的程式是多client傳畫面給server的程式
傳畫面的程式是依據 javaworld的良哥葛的SimpleScreenCaptureServer
這個程式大概跑了十分鐘後就會出現 outOfMemory的問題
heap space爆掉了 問題顯示在在傳client傳byte[]給server
跟server接收client傳byte[]的地方
那一段程式碼如下:
public Image getImageFromServer() throws IOException, ClassNotFoundException {
connectionClient.sendMessageToServer("GET " + getImageQuality());
byte[] imageByte = (byte[]) connectionClient.getObjectFromServer();
JPEGImageDecoder decoder =
JPEGCodec.createJPEGDecoder(
new ByteArrayInputStream(imageByte));
return (Image) decoder.decodeAsBufferedImage();
}
錯誤訊息如下:
Exception in thread "Thread" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.<init><DataBufferInt.java:41>
at java.awt.image.Raster.creatPackedRaster<Raster.java:458>
at sun.awt.image.codec.JPEGImageDecoderImpl.allocateDataBuffer<JPEGImageDecoderImpl.java:334>
at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream<Native Method>
at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage<JPEGImageDecoderImpl.java:210>
希望各位大大可以為小妹解惑
感激不盡!!
--
http://www.wretch.cc/album/jjor
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.125.128.242
推
04/17 00:46, , 1F
04/17 00:46, 1F
→
04/17 00:48, , 2F
04/17 00:48, 2F
推
04/17 00:53, , 3F
04/17 00:53, 3F
→
04/17 01:03, , 4F
04/17 01:03, 4F
推
04/17 01:09, , 5F
04/17 01:09, 5F
→
04/17 01:14, , 6F
04/17 01:14, 6F
推
04/17 02:33, , 7F
04/17 02:33, 7F
→
04/17 02:35, , 8F
04/17 02:35, 8F
推
04/17 02:37, , 9F
04/17 02:37, 9F
推
04/17 03:36, , 10F
04/17 03:36, 10F
推
04/17 08:38, , 11F
04/17 08:38, 11F
推
04/17 08:41, , 12F
04/17 08:41, 12F
推
04/17 10:02, , 13F
04/17 10:02, 13F
推
04/17 11:16, , 14F
04/17 11:16, 14F
推
04/17 12:14, , 15F
04/17 12:14, 15F
推
04/17 12:20, , 16F
04/17 12:20, 16F
→
04/17 12:22, , 17F
04/17 12:22, 17F
推
04/17 12:29, , 18F
04/17 12:29, 18F
→
04/17 12:31, , 19F
04/17 12:31, 19F
推
04/17 12:59, , 20F
04/17 12:59, 20F
推
04/17 13:05, , 21F
04/17 13:05, 21F
→
04/17 13:08, , 22F
04/17 13:08, 22F
→
04/17 13:09, , 23F
04/17 13:09, 23F
推
04/17 13:47, , 24F
04/17 13:47, 24F
→
04/17 13:49, , 25F
04/17 13:49, 25F
→
04/17 13:51, , 26F
04/17 13:51, 26F
推
04/17 13:52, , 27F
04/17 13:52, 27F
→
04/17 13:54, , 28F
04/17 13:54, 28F
→
04/17 13:56, , 29F
04/17 13:56, 29F
推
04/17 17:48, , 30F
04/17 17:48, 30F
推
04/17 19:38, , 31F
04/17 19:38, 31F
推
04/17 21:19, , 32F
04/17 21:19, 32F
推
04/17 21:22, , 33F
04/17 21:22, 33F
推
04/17 21:22, , 34F
04/17 21:22, 34F
→
04/17 21:24, , 35F
04/17 21:24, 35F
→
04/17 21:55, , 36F
04/17 21:55, 36F
推
04/18 12:13, , 37F
04/18 12:13, 37F
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 7 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章