We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Java Heap Space exception while loading eml file using aspose.email for java

Hello Team,

I have to load .EML file into MailMessage but i got Java heap space exception.I have to convert mbox file into PST file.I am using Operating System "Mac OS X 10.10.5 " and language java.
My source .EML file size is of 42MB so it get fail.

***short source code

f_objMailMessage = MailMessage.load(f_ObjFile.getAbsolutePath()) ;


Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at com.aspose.email.system.io.MemoryStream.setCapacity(Unknown Source)

at com.aspose.email.system.io.MemoryStream.b(Unknown Source)

at com.aspose.email.system.io.MemoryStream.write(Unknown Source)

at com.aspose.email.mw.write(SourceFile:321)

at com.aspose.email.dv.a(SourceFile:167)

at com.aspose.email.agh.a(SourceFile:377)

at com.aspose.email.agh.a(SourceFile:252)

at com.aspose.email.agh.a(SourceFile:265)

at com.aspose.email.agh.c(SourceFile:157)

at com.aspose.email.MailMessage.a(SourceFile:1402)

at com.aspose.email.MailMessage.b(SourceFile:1316)

at com.aspose.email.MailMessage.a(SourceFile:1238)

at com.aspose.email.MailMessage.load(SourceFile:1223)

at SysTools.MBOX_Reader.main


We have tested the scenario using Mac OS and observed the issue. You may please increase the heap size for your project as it had resolved the problem here. Please give it a try and share the feedback.