dcsimg
Out of Memory getting Attachments
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gustavo_Balboa
Posted On:   Thursday, July 19, 2001 01:41 PM

Hi, I'm trying to download an attachment like this: InputStream is = part.getInputStream(); int i; while ((i = is.read()) != -1) out.write(i); out.flush(); out.close(); where "out" is a ServletOutputStream and part is : Multipart m =(Multipart)sg.getContent(); part = m.getBodyPart(PartNum); the servlet reports OutOfMemoryException with all large attachments, what can I do to solve the problem? does the "getInputStream()" method put all the data in memory (byte array or something)?    More>>

Hi,


I'm trying to download an attachment
like this:

			
				
InputStream is = part.getInputStream();
int i;
while ((i = is.read()) != -1)
out.write(i);
out.flush();
out.close();

where "out" is a ServletOutputStream
and part is :
			
				
Multipart m =(Multipart)sg.getContent();
part = m.getBodyPart(PartNum);

the servlet reports OutOfMemoryException with all large attachments,


what can I do to solve the problem?
does the "getInputStream()" method put all the data in memory (byte array
or something)?

   <<Less

Re: Out of Memory getting Attachments

Posted By:   Simon_Ablett  
Posted On:   Monday, September 3, 2001 08:07 AM

Have you tried increasing the amount of space allocated to the JVM using the -Xmx and -Xms command line parameters ? This might help.
Regards.

Re: Out of Memory getting Attachments

Posted By:   John_Zukowski  
Posted On:   Thursday, July 19, 2001 08:50 PM

In answer to your last question. Yes.


To answer your first question, increase stack space. Buy more memory. Send smaller attachments.

About | Sitemap | Contact