I am getting this error
There is not enough free memory to run this program. Quit one or more programs, and then try again
while saving mail on local.
This error generally occurring on machine which have more than 40000 mails.
I am continuously parsing through 40000 mails.
Dont use foreach for it – convert it to oldschool