You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonio Petrelli <ap...@apache.org> on 2006/10/20 09:13:54 UTC

[OT] Re: java.lang.OutOfMemoryError: Java heap space

B.Sridhar ha scritto:
> yes .  actually my appln initially downloads the file from database to a
> temp directory of the tomcat as a temp file and then from there iam 
> reading
> it to display.  So the file is not getting stored in the temp directory.
> while getting the file from database its displaying exception
>
> On 10/20/06, Antonio Petrelli <ap...@apache.org> wrote:
>> You haven't your 85MB file in your memory, right?

Oh, boy, so if you have 1 GB of a file, you want to store it ALL in memory?
If you want to put your file in a temp directory, read it in chunks 
(e.g. 1kB at a time) and write it in chunks.
You can also use Commons IO, in particular IOUtils.copy:
http://jakarta.apache.org/commons/io/api-release/org/apache/commons/io/IOUtils.html#copy(java.io.InputStream,%20java.io.OutputStream)

HTH
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: java.lang.OutOfMemoryError: Java heap space

Posted by "B.Sridhar" <bs...@gmail.com>.
Hi,
thanks for ur suggestion, i have used commons.IOutil and its working!
bye

On 10/20/06, Antonio Petrelli <ap...@apache.org> wrote:
>
> B.Sridhar ha scritto:
> > yes .  actually my appln initially downloads the file from database to a
> > temp directory of the tomcat as a temp file and then from there iam
> > reading
> > it to display.  So the file is not getting stored in the temp directory.
> > while getting the file from database its displaying exception
> >
> > On 10/20/06, Antonio Petrelli <ap...@apache.org> wrote:
> >> You haven't your 85MB file in your memory, right?
>
> Oh, boy, so if you have 1 GB of a file, you want to store it ALL in
> memory?
> If you want to put your file in a temp directory, read it in chunks
> (e.g. 1kB at a time) and write it in chunks.
> You can also use Commons IO, in particular IOUtils.copy:
>
> http://jakarta.apache.org/commons/io/api-release/org/apache/commons/io/IOUtils.html#copy(java.io.InputStream,%20java.io.OutputStream)
>
> HTH
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
B.Sridhar