本人在linux下开发了一个在内存中生成图片的小程序,由于没有启动xserver,所以java.awt包下很多东东都用不了,只能拐着弯实现,以至碰到了内存泄露的问题,请教各位高手帮一下忙!
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.awt.image.BufferedImage; import javax.imageio.*; import javax.imageio.stream.*; public class AuthImage extends HttpServlet { private static final int NUMBER[][]={ {-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1, -1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1, -1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1, 1,1,1,-1,1,1,1,-1,-1,-1,1, -1,-1,-1,1,1,1,-1,1,1,1, 1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1, -1,1,1,1,-1,-1,-1,-1,1,1,1, 1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1, 1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,1, 1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1, 1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1, 1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,1, -1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,1, 1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1, 1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1, 1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1, -1,-1,1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1, -1,-1,1,1,1,-1,-1,1,1,1,-1,-1, -1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1, -1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,1, -1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1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-1,1,-1,-1,1,1, 1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1, 1,1,1,-1,-1,-1,1,1,1,1,-1,-1,-1, -1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1, 1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1, 1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1, -1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1}
}; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final int width=15, height=26,length=4; BufferedImage bi=new BufferedImage(width*length,height,BufferedImage.TYPE_INT_RGB ); int a1=(int)(Math.random()*10); int a2=(int)(Math.random()*10); int a3=(int)(Math.random()*10); int a4=(int)(Math.random()*10); bi.setRGB(0*width,0,width,height,NUMBER[a1],0,width); bi.setRGB(1*width,0,width,height,NUMBER[a2],0,width); bi.setRGB(2*width,0,width,height,NUMBER[a3],0,width); bi.setRGB(3*width,0,width,height,NUMBER[a4],0,width);
response.setContentType("image/jpeg"); ServletOutputStream outstream = response.getOutputStream();
Iterator ite = ImageIO.getImageWritersByFormatName("jpeg"); ImageWriter imageWriter = (ImageWriter) ite.next();
ImageOutputStream ios = ImageIO.createImageOutputStream(outstream); imageWriter.setOutput(ios); imageWriter.write(bi); ios.flush(); imageWriter.dispose(); ios.close(); outstream.close();
}
public void destroy() { } }
请帮帮忙,这个小鸟让我的机器运行不到一天,tomcat就出现outofmemeory的致命问题。
///////// // //我少发言论,但我多关注 ////
|
|