Problems with huge mBox file

I have problems with mbox reader demo application.
To suit my needs I have to anlize over 2GB Inbox file.
Demo application raise an error on:

MboxrdStorageReader reader = new MboxrdStorageReader(stream, true);

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at com.aspose.ms.System.IO.d.a(Unknown Source)
at com.aspose.ms.System.IO.d.b(Unknown Source)
at com.aspose.network.aQ.a(Unknown Source)
at com.aspose.network.MboxStorageReader.(Unknown Source)
at com.aspose.network.MboxrdStorageReader.(Unknown Source)
at ThunderbirdMboxRead.main(ThunderbirdMboxRead.java:43)

I
understands that It is quite hard to load all the Inbox file into
memory, but is there a way to parse this huge file, get only messages
list and then extract only few of them?

I’ve already tried running demo app with args:

-vmargs
-Xms512m
-Xmx1024m

Hi,

Thank you for inquiry.

We will perform some tests with large sized mbox files and will get back to you later.

Whatever happened to this?

Hi Albert,


Please accept my apologies for the delayed response.

I can reproduce the same exception with a small sized (~400MB) Mbox file and by using the latest version of Aspose.Email for Java v1.6.0. For correction purposes, a ticket (NETWRKJAVA-33137) has been logged in our bug tracking system.

We will keep you posted with updates on this.

[Edited] If you want to get notified regarding any progress on this issue then I would suggest you to create a new thread so I may attach the same ticket to it.
Thanks and Regards,

Is this still a problem in v1.9.0?

Hi Albert,


Thank you for your patience.

I am afraid to mention that the issue attached to this request is currently unresolved. The ticket is scheduled for upcoming release of Aspose.Email for Java v2.0.0. As soon as we have made significant progress towards the resolution of the ticket, we will let you know here.

Regards,

Hi,


We have worked with the issue mentioned in this thread. It proved to be a well known issue and have a simple solution, that is; increase the memory for java process through -Xms and -Xmx java command line options. Below is a sample command,

-Xms512m -Xmx1200m


Alternatively, give a try to the custom build of Aspose.Email for Java that is attached to this post. Below are code samples for your reference,

new MboxrdStorageReader(String fileName)
MboxrdStorageReader reader = new MboxrdStorageReader(mboxFileName); try
{ MailMessage msg; while ((msg = reader.readNextMessage()) != null) { System.out.println(msg.getSubject()); } } finally { if (reader != null) reader.dispose(); }

new MboxrdStorageReader(com.aspose.email.ms.System.IO.Stream stream)
FileStream stream = new FileStream(mboxFileName, FileMode.Open); MboxrdStorageReader reader = new MboxrdStorageReader(stream, false); try { MailMessage msg; while ((msg = reader.readNextMessage()) != null) { System.out.println(msg.getSubject()); } } finally { if (reader != null) reader.dispose(); }

Please feed us back with results.
Regards,