Aspose.Email throws an exception while loading mail object to mapi message

Hello Team,


I’ve been using Aspose.Email SDK for create PST file, i’m currently using version 16.11.0 latest version of aspose.

Please see the following sample code :
string f_tmpEmlPath = “eml file”;

MailMessage f_Objmailmessage = MailMessage.Load(f_tmpEmlPath, new EmlLoadOptions());

f_mapimessage = MapiMessage.FromMailMessage(f_Objmailmessage, MapiConversionOptions.UnicodeFormat);

It throws an exception as follow :
=========================================================
Exception of type ‘System.OutOfMemoryException’ was thrown.
ERROR2016-11-24 15:40:19 - Stack Strace :: at System.String.Replace(String oldValue, String newValue)
at Aspose.Email.Outlook.MapiProperty.#=qS$ZyIpxpQHTXRni3C8ci9oa7tqfiIthwxcp1sY4WLfA=(String #=qHZ80zhhxFbM8KX9lfDetMQ==)
at Aspose.Email.Outlook.MapiProperty.GetString()
at Aspose.Email.Outlook.MapiPropertyContainer.GetPropertyString(Int64 tag)
at Aspose.Email.Outlook.MapiMessageItemBase.#=q7UwGSCq4HShnpLVf$DDxmA==()
at Aspose.Email.Outlook.MapiMessageItemBase.get_Body()
at Aspose.Email.Outlook.MapiMessage.#=qvil_uRAUwSdfmBZEj0Gv0oRysKx$j_271qI0ALWnzdM=(MailMessage #=qtR5AAt_wBk_lHohaLyuS6Q==, MapiConversionOptions #=qD6Wz5UxQck1anBGMn0IJdg==)
at Aspose.Email.Outlook.MapiMessage.#=qo0jXFM82MRjhH3TKoDpLR6ErZ5wvdhU4TSrbAG7Mg50=(MailMessage #=qzqrTnll4dhrN6eS4wIaf9Q==, MapiMessage #=qyQlAlTgVCfwTjDz69zAhFw==, MapiConversionOptions #=qD6Wz5UxQck1anBGMn0IJdg==)
at Aspose.Email.Outlook.MapiMessage.#=qsfyNjeEtuX4HrDz7nV40EQ==(MailMessage #=qtR5AAt_wBk_lHohaLyuS6Q==, MapiConversionOptions #=qD6Wz5UxQck1anBGMn0IJdg==)
===================================================================

Up to my RND, i came to know there is no problem in the eml file, its the problem with memory pile-up, as the eml size is 25.7mb and its not the matter of giving the eml to you for reproducing it as the exception is of system out of memory and for an instance if i gave the eml and is going to run anyway in your machine as it will be treated with fresh instance of mailobject with running as one time.

Keeping the trail of exception, this issue doesn’t occurs in 64bit, it occurs only with 32-bit machine, as 32-bit restrict the usage of memory to only 2GB even if there is 4 or 8 GB of RAM installed in machine.

However this issue can be reproduced by running an testing application on 32bit machine which have for-loop with the provide code in the thread.(i am not sure about this).

I’m applying a bulk (which as around 28,000 which has some 8-9 eml which has size of 25mb) of eml in a single threaded application one after the other its load eml and save the email in the pst using your SDK, at some point at moment arises where its gets shortage of memory and throws outofmemory exception, even after that if i called GC.collect() and GC.WaitForPendingFinalizers(); to wait current operation when all the internal thread of CLR which has object needed to be clear, it gets cleared but when we retry to load the eml in Aspose SDK it take too much memory to load.

I’ve gone through the string replace method in the stack trace of the exception, i think if you can use string builder instead of string.replace might work so that memory would be optimized so that remaining memory can be used to perform other work, i don’t know much the work or code of aspose, but these are the finding is from my side, please correct me if i’m wrong.

I really appreciate your work on this, can you please take this case on high priority and resolve this.

Awaiting for positive response.

Thank You.

Regards.
Amit.

Hi Amit,


Thank you for writing to Aspose support team.

I have analyzed the issue and logged it in our issue tracking system under Id: EMAILNET-38547 for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.


The issues you have found earlier (filed as EMAILNET-38547) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.