jmagick produce image in memory?

Hi friends,

I want to produce image via jmagick. But I don't want to produce a real file. So I produce image which save in the memory. When jmagick process completely, image will transfer to client.

I wrote sample code, as follows:

ImageInfo info;

MagickImage image;

MagickImage scaled;

try{

System.setProperty("jmagick.systemclassloader","no");

info =new ImageInfo(request.getRealPath("/")+"Image/"+filename);

image =new MagickImage(info);

image = image.cropImage(new Rectangle(0,0,100,100));

scaled = image.scaleImage(200,200);

byte data[]=scaled.imageToBlob(new ImageInfo());

response.setContentType("image/jpeg");

OutputStream toClient=response.getOutputStream();

toClient.write(data);

toClient.close();

}catch(MagickApiException ex){

System.out.println(ex);

}catch(MagickException ex){

System.out.println(ex);

}finally{//release memory

info=null;

image=null;

scaled=null;

System.gc();

}

But I found......

When many people connect to this webpage, my memoey will increase very fast. And jmagick will not produce image. I don't know how to solve this problem.

Please Help me...

Thank you very much..

Regards,

[2075 byte] By [little1981a] at [2007-10-3 3:24:52]
# 1
If you create a lot of images in memory then that will take memory. So memory will go up.I have no idea what ou mean when you say the image isn't produced. Do you mean never? Then there is something wrong with your code here or you are not returning the correct thing to the
jschella at 2007-7-14 21:17:43 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
When only one use this webpage, it works very well. You can see image in this webpage. But over two people use it. They can't see image in this webpage. I don't know where is problem.Thanks...
little1981a at 2007-7-14 21:17:43 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
To me that would suggest that something is wrong with how you are handling multiple users rather than anything to do with this package.Try doing nothing but returning a static image (load it from a file.) Until that works with more than one user do not try to use this package.
jschella at 2007-7-14 21:17:43 > top of Java-index,Java HotSpot Virtual Machine,Specifications...