10.11, Mail.app Memory Leak?

About 24 hours after upgrading to OS 10.11 (el capitan), Mail.app had essentially used up all available system memory bringing up the "Your system has run out of application memory" dialog and necessitating force quitting Mail.app. Since that initial force quit, Mail.app will reliably repeat this cycle when force quit and restarted — it works for about 5-10 minutes while it gobbles up RAM (apparently reading disc and dumping directly into RAM as the bytes read from disc in activity monitor initially correlate closely with the memory used). System reboot didn't break the pattern. I don't have any extensions installed in Mail...


Any thoughts? Feels like a memory leak. I can't imagine what its reading from disc - 120 gb is a substantial chunk of my hard drive...so, it seems it must be doing something repetitive...

User uploaded fileUser uploaded file

MacBook Pro with Retina display, OS X El Capitan (10.11), stock machine, no add-ons.

Posted on Oct 2, 2015 5:41 AM

Reply
79 replies

Oct 7, 2015 12:28 AM in response to epikeia

Followed Linc Davis' instructions and found that it solved the problem. However, I knew that I didn't have to move the Mail folder as I had tried that earlier with no luck.


Once the same problem happened on two other computers I narrowed it down to one of the steps in the previous solution. Simply go to the user's library and delete:

Containers/com.apple.mail

That seems to sort it.

Oct 7, 2015 3:50 AM in response to Luigino il Pazzo

Same as this one Mail on El Capitan



I find that the new Mail app in El Capitan is trying to clean up the log files by zipping them in memory which caused the problem.


Try to delete your log file manually in the following folder (Command + Shift + G):

~/Library/Containers/com.apple.mail/Data/Library/Logs/Mail/


You may see huge size log files in the folder ...just delete all *.log and restart your Mail App. Then, things should back to normal

Oct 9, 2015 7:53 AM in response to miguel.apple

Just curious. Your suggestion seems to have worked for me as well. However, after clearing all these log files, I find they're accumulating again With mail running in the background on my laptop for about an hour, the largest of them (which contains "EWS" in its filename, so must be from my Exchange account), is already 4.45 GB in size (during this time I've sent one message and received one via my Exchange Account (our server is Windows Small Business Server 2008 running Exchange 2007). So, two questions:


1. Have you (or any other thread participants, seen these log files grow this rapidly after they've been deleted?

2. Has everyone afflicted by this issue had an Exchange email account configured in Mail.app (better to phrase this "has anyone who doesn't have an Exchange account experienced this issue?


Thanks so much!

Oct 9, 2015 9:51 AM in response to miguel.apple

Thank you. This simple suggestion solved my problem immediately. The mail app was making my map unusable. The activity monitor showed the mail app was using nearly 70 gb. As soon as I did this fix its back to 100 mb and the computer all around seems to run faster in nearly every app. Is this something I should do periodically, and are there other .log files for other apps that will clean and speed up my mac even more?

Oct 9, 2015 3:06 PM in response to JimRobertson

Three other observations since I followed miguel.apple's advice:

  1. On my laptop that is running OS X 10.11, the file that's been mushrooming in size is 2015-10-09_EWSBodyFetch.log.
  2. If I take my Exchange account offline, that log file stops growing.
  3. On the machine running El Capitan, if the Exchange Account is active, the 3-pane default message window in Mail.app displays "Downloading Messages" continuously at the lower left corner of the screen, with the same numerator and denominator; e.g., "Downloading Messages" 104 of 104. That message disappears when I take the Exchange Account offline, and it's not present on my machine that is still running Yosemite.

Oct 10, 2015 8:46 AM in response to Chakdag

Chakdag wrote:


Luigino's solution worked perfect for me.

Haven't tried Miguel's as my log files seemed to have normal sizes (a couple of Mb for the biggest).

Thanks guys

I've been "investigating" (more like fumbling in the dark, since I don't know much about what I'm doing beneath the surface of the Mac GUI), but I've discovered several things:

Although deleting the log files brought mail back to life temporarily, the contents of the log folder pointed out by Miguel immediately started to grow again, reaching several GB within an hour!

Several things suggested my problem lay in my Exchange mail account, and, curiously, there was NOT a problem with that same account on another Mac still running Yosemite. Among these:

  • If I took the Exchange account offline, the log files stopped growing immediately.
  • The file growing so rapidly was named 2015-10-10_EWSBodyFetch.log (EWS is an abbreviation for Exchange Web Services)
  • If I looked at that file in Console while the Exchange account was offline, it had been collecting literally hundreds of iterations of the same message per second, to wit;
  • Oct 10 07:27:52 Mail[5157] <Debug>: <MFEWSBackgroundBodyFetchTask: 0x7ffd3065e560> Fetched bodies for 0 messages, missed 0 messages. 0 mandatory bodies remaining, 1 discretionary bodies remaining, 0 fetched bodies to persist
  • With the Exchange account online, I could watch the EWSBodyFetch.log file grow in the finder by the second at a remarkable rate. While it was doing this, in Mail, a message below the list of mailboxes in the 3 panel view would read "Downloading Messages; 104 of 104" above which was a progress bar that never quite reached its end
  • Manually cleaning up my Exchange inbox didn't find any rogue messages (I don't know if the above Console message or any of the other messages in the Console log would have provided clues).

A person whose advice I trust on a Mac email listserv suggested deleting and recreating my Exchange account in Mail. I didn't plunge directly ahead with that, but I did create a new Mac user on my El Capitan-running laptop and recreated my Exchange Account in that user space. That succeeded, (meaning that all my folders appeared in the new user's iteration of my Exchange Account, and that in the new user's space, the Exchange account was a good citizen (no continuous downloading of one single message, no mushrooming log files, etc.).


Now emboldened, I deleted the Exchange account in my standard Mac user space and recreated it, and it appears my problems are solved!

Oct 15, 2015 8:11 PM in response to JimRobertson

Hi there,


Here is what I have learned in that tedious process of fixing Mail :

- if your Mail is leaking RAM then deleting Containers/com.apple.mail and your oversized *.log file will help you take back control of your computer. Ref. Luigino and Miguel's solutions combined.

- BUT THIS WILL NOT FIX IT

- the log file will keep growing rapidly as stated by JimRobertson and eventually you'll end up with the same problem again.

- likewise, as Jim said, you'll notice that the activity bar of Mail is stuck downloading / fetching messages.

- given Jim's explanation and what I have noticed, this can happen as much as with IMAP as with Exchange configuration apparently (my case was IMAP) and the mutant file was yyyy-mm-dd_IMAPSyncActivity.log

- you might not notice this behavior immediately if you don't keep Mail open all the time as these *.log files are daily files and every day it'll zip the old one and recreate a new one with a new date.

- to see if you have a mutant .log file you need to monitor it with Console as suggested by Jim and you will see the entries that'll keep coming and the size of the file increasing crazily fast.

- at this stage you'll need to identify which account is generating these repeated entries in your *.log file. In my case it was the only IMAP account from an external provider (not iCloud nor Gmail).

- Like Jim, deleting and reinstalling this erratic account is the only thing that had fixed it and everything went back to normal.

- Don't forget to delete your old oversized *.log file prior to this so you start clean.

- After this keep monitoring the .*log file through Console to check it's behavior.


Good luck !


Chak

Oct 19, 2015 2:41 PM in response to HaggisArts

HaggisArts wrote:


miguel.appleTHANK YOUUUUU!!! I was ready to throw my iMac out of my 3rd floor window. Quick question. Will I have to do this often, or will this one-time deletion of these huge log files take care of the issue for good? Thank you again.

The messages at the end of the conversation, from me and from Chakdag hopefully will address this for you. The log files grow because there's a problem with something that they're recording. It appears that "something" may be the transmission of a somehow damaged message from an IMAP or Exchange server. You can watch those log files grow by the second if you open "Console", the program that records what your Mac is doing behind the "GUI" (graphics user interface). Another clue can come from the Message Viewer main window in Mail itself, which my constantly display attempts to download the same message over and over. If either of these is true, deleting the IMAP or Exchange accounts in question from your Mac, then re-creating them may solve your problem, as it has for us.


What I don't understand is why ONE instance of an account may be so afflicted, but a new instance of that email account in the same user space won't be. Typically, the problem has been discovered after an OS X upgrade, so there must be some interaction between the upgrade process and the contents of the mail account, but I have no idea what it is. In my case, it was an Exchange Account. In some other peoples' cases, it's been an IMAP account.


Please note that while it's safe to delete and recreate a properly (or improperly) functioning IMAP account, that's NOT the case for POP accounts, and if you don't know why, you shouldn't be messing with this stuff in the first place!


Jim Robertson

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

10.11, Mail.app Memory Leak?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.