Recently there has been a lot of talk about memory usage, and James in it's default setup is NOT very memory friendly. But there is things you can do about it.
Unless you have dedicated computer which only purpose it is to run James, James has to be a good citizen, not occupying all the memory. A good citizen should be allowed to use a lot of memory for example for handling large emails, but when the handling is over it must release the memory again, to enable other citizens to handle there peaks too.
To enable James to handle large emails I have added the -Xmx option. My Linux box have 512 Mb ram so I have set the option to -Xm300m. This allows James to allocate up to 300 Mb ram.
One thing I find strange about Java's memory handling, is that in it's default setup it's NOT acting like a good citizen. It likes to hold on to the memory it has already allocated. After a Garbage Collection has run, Java decides whether it should allocate more or release some of its memory, based on the "Used heap" / "Total heap" ratio. In it's default setup memory is release if more than 70% of the heap is unsed. In other words if the total heap is 100 Mb, up to 70 Mb can be unused, but still unusable by other citizens. That's in my opinion a big waste of memory. Fortunately there is something to do about it. In my James implementation I have added the following options:
-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10
These options give me a much politer behavior and the memory usage is now acceptable.
Another thing I've done is force James to run the Garbage Collector more often. I'm using the new FetchMail feature, and every second minute a fetchTask is run. In this fetchTask I've added a call to System.gc() to force the Garbage Collector to run.
Now I have a system that is able to handle large emails but relatively fast releases its used memory.
I know this is not the right place to add it, but I don't have the knowledge to determine where it should be.
I hope you can use it.
Steen Jansdal
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
