myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Quentel" <mquen...@4dm-inc.com>
Subject RE: Java Heap Space
Date Thu, 18 Jun 2009 14:33:02 GMT
Some possibly helpful information--this pertaining to garbage collection: 

http://developer.amd.com/documentation/articles/pages/4EasyWaystodoJavaGarba
geCollectionTuning.aspx

http://www.fasterj.com/cartoon/cartoon087.shtml


Mike Quentel

-----Original Message-----
From: Richard Yee [mailto:richard.k.yee@gmail.com] 
Sent: 18 June 2009 09:05
To: MyFaces Discussion
Subject: Re: Java Heap Space

Take a look at the HttpServletResponse.setBufferSize() and
flushBuffer() methods. Perhaps you should call flushBuffer instead of
os.flush()?

-R

On Wed, Jun 17, 2009 at 12:23 PM, Wolfgang
Grabow<wolfgang_grabow@gmx.net> wrote:
> Hi Mike,
>
>
> thx for the hints. I updated and tracked down the memory issue.
> It's actually that java's buffering the whole file before beginning
> the streaming to the user.
>
> Any ideas on how to prevent that?
>
>
>        tia
>
>
>                W
>
> Mike Quentel (4DM) schrieb:
>> Try upgrading to the latest JVM.  Analyse threads in JConsole.  Might
there need to be some blocks of code set to synchronised?
>>
>> Perhaps you have already done the above; but these are good ways to rule
out the sources of leaks, as well as to diagnose the issues.
>>
>>
>> ------Original Message------
>> From: kaphbeth@gmx.net
>> To: users@myfaces.apache.org
>> ReplyTo: MyFaces Discussion
>> Subject: Java Heap Space
>> Sent: 16 Jun 2009 04:36
>>
>> Hi %,
>>
>>
>> I'm facing a wired issue with the java heap space which is close
>> to bringing me to the ropes.
>>
>> The short version is:
>>
>> I've written a ContentManagementSystem which needs to handle
>> huge files (>600mb) too. Tomcat heap settings:
>>
>> -Xmx700m
>> -Xms400m
>>
>> The issue is, that uploading huge files works eventhough it's
>> slow. Downloading files results in a java heap space exception.
>>
>> Trying to download a 370mb file makes tomcat jump to 500mb heap
>> (which should be ok) and end in an Java heap space exception.
>>
>> I don't get it, why does upload work and download not?
>> Here's my download code:
>>
>>       byte[] byt = new byte[1024*1024*2];
>>
>>       response.setHeader("Content-Disposition", "attachment;filename=\""
+ fileName + "\"");
>>
>>       FileInputStream fis = null;
>>       OutputStream os = null;
>>
>>       fis = new FileInputStream(new File(filePath));
>>       os = response.getOutputStream();
>>
>>       BufferedInputStream buffRead = new BufferedInputStream(fis);
>>
>>       while((read = buffRead.read(byt))>0)
>>       {
>>               os.write(byt,0,read);
>>               os.flush();
>>       }
>>
>>       buffRead.close();
>>       os.close();
>>
>>
>> If I'm getting it right the buffered reader should take care of any
>> memory issue, right?
>>
>> Is there a chance that JSF interferes my tomcat settings?
>> Any help would be highly appreciated since I ran out of ideas.
>>
>>               Best regards,
>>
>>                  W
>>
>


Mime
View raw message