Posted: December 15, 2009 00:07 by netray
I'm experiencing exactly the same problems as in
and I have exactly the same task: dump POP3Message contents to .eml file.
In your case, you know that the only operation you're going to do on the message is to write it to your stream. While it would certainly be possible to optimize that case, that wouldn't be the right optimization for all cases. A more generally useful optimization that I've considered is to cache the messages on disk instead of in memory. That would reduce the memory required for your case, but wouldn't be as efficient. I'm willing to consider a special optimization to handle your case, but it certainly couldn't be the default behavior.
How can I optimize memory usage for this case? Since I do not know the maximum allowed size of mime messages in the inbox - changing -Xmx option will always be a temporary solution.