Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

JavaMail API Closing folder causes OutOfMemory

Thread view: 
hagarwal@tamaleresearch.com - 06 Apr 2006 15:38 GMT
Hello
I am getting an OutOfMemory error when I try to call close on Folder
with expunge set to true.

This is happening when I am having a large a number of e-mails with
large attachments to be expunged.

Any one else experienced this error? There are some postings that
indicate that there might be a possible leak in JavaMail API, but
nothing seems to be conclusive.

I will be using a memory profiler to try to figure out what exactly is
causing the leak, but any hints will be helpful.

Thanks
Harsh
Greg R. Broderick - 07 Apr 2006 17:44 GMT
hagarwal@tamaleresearch.com wrote in news:1144334300.712910.164650
@e56g2000cwe.googlegroups.com:

> I am getting an OutOfMemory error when I try to call close on Folder
> with expunge set to true.

Source code?

Which version of JavaMail?

Which subtype of Folder?  javax.mail.Folder is an abstract class that
has at least two concrete subclasses, com.sun.mail.imap.IMAPFolder and
com.sun.mail.pop3.POP3Folder.

You might also have better success asking this question on a JavaMail-
specific forum, such as the mailing list that is run by Sun for
JavaMail.  See
<http://java.sun.com/products/javamail/community/mailinglists/index.htm
l> for details.  This mailing list is also gatewayed to the new group
gmane.comp.java.sun.javamail.general at the news server news.gmane.com.

Cheers
GRB
hagarwal@tamaleresearch.com - 10 Apr 2006 14:25 GMT
Allright, so its not closing the folder. It seems that Sun's
implementation of Javamail API hold messages in memory (isn't that
stupid). So my applciation was throwing Outofmemory when there were
many messages with huge attachments.
hagarwal@tamaleresearch.com - 18 Apr 2006 18:52 GMT
For anyone interested, I had to re-architect my mail processor to
dynamically figure out whether it has enough memory to process the next
message. If it does not, it closes the folder thus making all the
messages available for garbage collection.

One can argue that this is not 100% fool-proof, but I have load tested
it sufficiently to be confident that the solution will work.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.