This project is read-only.

Imapx exception- outofmemoryException

Topics: Issues
Aug 30, 2012 at 12:32 PM
Edited Aug 30, 2012 at 12:44 PM

I am using imapx in my project to fetch mails from my gmail inbox and sentbox.But showing exception like outofmemory eception.Can u ol help me with this...

currently i m using imapx.dll not imapx2.

if i replace imapx with imapx2 is it gives any error in project?

 

 

 

 

Coordinator
Aug 31, 2012 at 9:49 AM
Edited Aug 31, 2012 at 9:50 AM

The upgrade to ImapX 2 shouldn't make any problems. Just make sure you're using .Net 4 in your project. If you get any errors, please post a detailed stacktrace here, so we can figure out what the problem is, and fix it

Aug 31, 2012 at 12:02 PM

Ok Thanks....but what about eception

 

Coordinator
Aug 31, 2012 at 4:10 PM

If you get any errors, please post a detailed stacktrace here, so we can figure out what the problem is, and fix it.

Sep 1, 2012 at 12:54 PM

we used following code--------------

 

string query = "SINCE " + formatDate + " ALL" ;
#region
// query will get last synchronisation time (with Gmail account) 
ImapX.
MessageCollection emails = client.Folders["INBOX"].Search(query, true );

 

 

get that error on line

MessageCollection emails = client.Folders["INBOX"].Search(query, true );

mainly when lot of mails with attachments r present to fetch from gmail we got outofmemoryException

 

 

plz help us .thanks

 

 

Coordinator
Sep 3, 2012 at 10:33 AM

Ok, now i understand what the problem is. It will take some time to fix it, i'll keep you up to date about the progress

Sep 15, 2012 at 6:58 AM

http://s10.postimage.org/6cwu02hnd/unhandle_Exception_Occur.png

 

plz chk this image we r getting problem PLZ Fix it as soon as possible. thanks :)

Coordinator
Sep 15, 2012 at 11:25 AM

Please keep up to date about this problem through the issue tracker. I'm working to fix it

Coordinator
Sep 15, 2012 at 1:08 PM

The problem occured when messages contained large attachments. The parsing failed on the Convert.FromBase64String method, for it can only be used to parse small strings.

I added an implemenation of a Base64 decoder/encoder which uses the FromBase64Transform and the ToBase64Transform classes from System.Security.Cryptography.

The problem is now fixed. Please update to the latest version and test it.    

 

Sep 20, 2012 at 11:45 AM

thanks for u r efforts but still getting same error :( plz chk it again

Coordinator
Sep 20, 2012 at 5:24 PM

Works fine for me. Do you have any big attachments in your mails? Can you send me a test mail that causes the error to p13a92@googlemail.com?

Sep 24, 2012 at 8:03 AM
Edited Sep 24, 2012 at 8:12 AM

.......

Coordinator
Sep 24, 2012 at 8:10 AM

Sorry, i was busy with my daily work, so couldn't check on the issue yet. Will test ImapX with the credentials you provided later today and let you know.

Sep 24, 2012 at 8:13 AM

ok no problem take u r time.....! :)

Coordinator
Sep 24, 2012 at 4:01 PM

I fixed the problem, please update to the latest version of ImapX & ImapX Sample

Sep 25, 2012 at 6:49 AM

Thank you

Sep 25, 2012 at 7:00 AM

Wow Thanks A lot :) i think its mejor problem till now?

btw what is the problem?

anyways its working perfectly now thanks for u r valuable support :)

Sep 25, 2012 at 9:22 AM
Edited Sep 25, 2012 at 9:28 AM

oops get outofmemory error :(

 

http://s6.postimage.org/jfvwwdp7l/System_Out_Of_Memory_Exception.png

Coordinator
Sep 25, 2012 at 9:40 AM

The exception occured when the library tried to parse a very long message, containing many answers in it, whole discussion history.

The parsing of the messages is still same as in the first version of ImapX, so not written by me, and has some bugs that become visible from time to time.

I'm planning to rewrite the message parsing to make it work faster and with less problems.

I'll check on the exception you just mentioned, should be nothing serious.

Sep 25, 2012 at 9:41 AM
Edited Sep 25, 2012 at 9:42 AM

i got another error in other acoount while fetching INBOX plz Chk it also

give 2 img r of same error devided into 2 parts for u r understanding



http://s6.postimage.org/le7684735/error1.png

http://s6.postimage.org/l2ppvcqn5/error2.png
Sep 25, 2012 at 9:57 AM

ok thanks the last 2 error r get when there is hug mails in it ,thats right.

[ i think its due to not comming octet stream in ( attachment ) it as we observed and added if condition in our project :) ]

i posted it just for u r inform .

the 2nd error we got its having almost 7GB of INBOX in that email id  :D

for me its sufficient to fetch max 300 mails daily so i think i will not get that error as no of mail r less :)

 

 

i just want to help u by reporting . u r doing great job :) Thanks

Sep 25, 2012 at 9:59 AM

ok best of luck for rewritting it. waiting for it :)

Coordinator
Sep 25, 2012 at 10:37 AM

I didn't expect anyone to have 7GB of mails in the inbox, even you having 500+ letters surprised me. But made me update the smaple application and make the message listview virtual, 'cause otherwise it simply required too much memory.

To the OutOfMemoryException in the attachement parsing: it always occurs when you got big files, 'cause some .net functions you can use on simple strings, such as ToCharArray, or the Convert.To/Frombase64String, don't work with big amounts of data.

All in all, it's not really smart to store all the data in memory and download the messages completely, but it requires more time to change that to a more elegant solution.

So for the first, will just provide a fix for the exception by replacing the ToCharArray method with some alternative.

Sep 26, 2012 at 5:58 AM

the updated dll u provided is working fine...thank u...

but whole procedure is very slow...

Coordinator
Sep 26, 2012 at 9:50 AM
Edited Sep 26, 2012 at 9:51 AM

Happy to hear it's working. There's going to be another update until the end of this week, solving the last problems shyamk128 has reported.

The downloading of big amounts of data is always slow, and i'm working on providing some interfaces which allow to partially download data you need and not everything at the same time.

Oct 3, 2012 at 5:28 AM
Edited Oct 3, 2012 at 5:28 AM

have u updated dll?????

 to make whole procedure fast....

Oct 3, 2012 at 9:32 AM

sorry again showing same exception for another account....

1. Exception

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.String.ReplaceInternal(String oldValue, String newValue)
   at System.String.Replace(String oldValue, String newValue)
   at ImapX.Base64.FromBase64(String s)
   at ImapX.Message.Process()
   at ImapX.Folder.Search(String path, Boolean makeProcess)
   at ImapX.Sample.FrmMain.GetMails()

2.Exception

 array out of index

Coordinator
Oct 3, 2012 at 9:44 AM

Sorry, a lot of daily work these days, so didn't manage updating the library yet. I'll fix the issue you mentioned as soon as possible.

The performance update is still in process, will take more time.

Nov 16, 2012 at 6:55 AM

have u updated dll?????

Coordinator
Nov 16, 2012 at 6:58 AM
Edited Nov 21, 2012 at 5:46 PM

Update 21.11.12:

Good day!

Please check out the new release of ImapX! It contains fixes for the OutOfMemoryException bugs and some more.

We'll be happy to hear feedback from you, feel free to tell us about your experience.

 

Best regards,

Pavel Azanov

Dec 15, 2012 at 8:15 AM

sample application showing donot connect problem when i am using my credentials.....

Coordinator
Dec 15, 2012 at 7:34 PM

Please check if the server is available, and whether you selected the right connection port and encryption. The sample application connects fine for me

Dec 17, 2012 at 4:56 AM
Edited Dec 17, 2012 at 5:12 AM
thank u
Sep 11, 2015 at 9:40 AM
Hello Pavel , reading emails in the inbox as I return an error out of memory . The message contains an attachment small .
I request your urgent help


System.OutOfMemoryException: Memoria insufficiente per continuare l'esecuzione del programma.
in System.Text.StringBuilder.ExpandByABlock(Int32 minBlockCharCount)
in System.Text.StringBuilder.Append(Char value, Int32 repeatCount)
in System.Text.StringBuilder.Append(Char value)
in ImapX.Parsing.BodyStructureParser.ReadQuotedString(Boolean trimSpaces) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Parsing\BodyStructureParser.cs:riga 317
in ImapX.Parsing.BodyStructureParser.ReadString(Boolean trimSpaces) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Parsing\BodyStructureParser.cs:riga 265
in ImapX.Parsing.BodyStructureParser.ReadLanguage() in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Parsing\BodyStructureParser.cs:riga 255
in ImapX.Parsing.BodyStructureParser.ParsePart(Int32 number, Int32 level) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Parsing\BodyStructureParser.cs:riga 201
in ImapX.Parsing.BodyStructureParser.Parse(Int32 level) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Parsing\BodyStructureParser.cs:riga 42
in ImapX.Parsing.BodyStructureParser.Parse(Int32 level) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Parsing\BodyStructureParser.cs:riga 38
in ImapX.Message.TryProcessBodyStructure(String data) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Message.cs:riga 451
in ImapX.Message.ProcessCommandResult(String data) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Message.cs:riga 243
in ImapX.Message.NormalizeAndProcessFetchResult(IList1 data) in \\serveralias\mach2press\SORGENTI\_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Message.cs:riga 586
in ImapX.Message.Download(MessageFetchMode mode, Boolean reloadHeaders) in \\serveralias\mach2press\SORGENTI\_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Message.cs:riga 554
in ImapX.Folder.Fetch(IEnumerable
1 uIds, MessageFetchMode mode) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Folder.cs:riga 441
in ImapX.Folder.Search(String query, MessageFetchMode mode, Int32 count) in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX\Folder.cs:riga 486
in ImapX.Sample.FrmMain.GetMails() in \serveralias\mach2press\SORGENTI_Esempi\ImapX 2.0.0.16 Source code (sample application included)\ImapX.Sample\FrmMain.cs:riga 457
Sep 11, 2015 at 1:30 PM
Edited Sep 11, 2015 at 1:46 PM
code with error ...
while (((currentChar = (char)_reader.Read()) != '"' || prevChar == '\\'))
                {
                    prevChar = currentChar;
                    sb.Append(currentChar);
                }
in BodyStructureParser.cs
Coordinator
Oct 8, 2015 at 2:05 PM
Hi donza,

Thank you, I will check it!

Greets,

Pavel