Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to force Javamail to clear its message cache?

843834Sep 23 2009 — edited Sep 23 2009
I'm running a server that uses Javamail. It has a count listener with IMAP's IDLE, such that when a new mail comes in, certain piece of code is executed. The list of new message is given to my listener as a parameter. I read the information off it and be done with it. All is good except my server leaks a lot of memory!! I did a heap dump and found that the class [Lcom.sun.mail.imap.IMAPMessage is using a lot of memory. It seems an array of IMAPMessage is referenced by the object com.sun.mail.imap.MessageCache.

Is there some caching going on? I don't need to access those messages ever again except for the first time it comes in. How do I force the cache to clear? How can I stop javamail from leaking?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 21 2009
Added on Sep 23 2009
6 comments
1,126 views