directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [MINA] OutOfMemoryError on streaming large files
Date Tue, 13 Dec 2005 05:11:44 GMT
2005/12/12, Niklas Therning <>:
> If my theory is correct the remedy would be to remove the while-loop and
> instead add the InputStream you're reading from as a session attribute.
> Then override messageSent() in your IoFilter and each time it gets
> called you write the next 4K of data from the InputStream. This way you
> write data in chunks of 4K and you only send the next 4K once the
> previous 4K has been sent.
> Once all the data from the InputStream has been written you forward the
> messageSent() call to the IoHandler with the original InputStream as
> message.
> If you try this out and it works I think we could add this filter to
> MINA if you are willing to share it.

My suggestion is easy to code, but it will make you to waste some threads.
Please try mine first and then try Niklas's suggestion.  His solution is
also correct, and more efficient.

what we call human nature is actually human habit

View raw message