ForTozs

Q: Memory leak in recentsd and Mail eating up all my RAM

Since I upgraded to Yosemite, the recentsd and Mail processes have been hogging all my RAM. Everything is fine after restart, but both processes slowly creep up until my computer is practically unusable. I am also getting a lot of these messages in console...

 

10/29/14 8:27:51.428 PM Mail[363]: Stream 0x60000031c5f0 is sending an event before being opened

 

I think the two problems mat be related. I have tried repairing permissions, SMC reset, and resetting the PRAM. I even tried

 

killall -9 recentsd

 

The problem persists. I read an article that Apple is storing a lot of my recent saves to the cloud here...

 

http://mjtsai.com/blog/2014/10/26/yosemite-uploads-unsaved-documents-and-recent- addresses-to-icloud/

 

Maybe something has gone wrong with this. Maybe its the result of my system not being handoff capable. I did unsuccessfully try to do a quite large mail drop the first day I installed Yosemite. Maybe this corrupted something. Either way, I consider this a major bug that I imagine wouldn't have made it to release if Jobs was still in charge. I feel Mac users are getting brushed aside more and more in favor of Apples more profitable projects. The memory leaks in Mail are happening to many other users. Many had GoDaddy IMAP accounts that were causing major issues. I don't have GoDaddy mail, and I am out of ideas. Does anyone have any idea how I can fix this?

MacBook Pro, OS X Yosemite (10.10)

Posted on Oct 29, 2014 6:53 PM

Close

Q: Memory leak in recentsd and Mail eating up all my RAM

  • All replies
  • Helpful answers

Page 1 Next
  • by Linc Davis,

    Linc Davis Linc Davis Oct 29, 2014 8:24 PM in response to ForTozs
    Level 10 (208,000 points)
    Applications
    Oct 29, 2014 8:24 PM in response to ForTozs

    Back up all data before proceeding.

    1. Triple-click anywhere in the line below on this page to select it:  

    ~/Library/Mail/Bundles

    Right-click or control-click the highlighted line and select

              Services â–¹ Open

    from the contextual menu.* A folder may open, or you may get an error message that the item can't be found. Either result is normal. If the folder does open and has contents, move the contents to the Desktop. Relaunch Mail and test. If there's no change, put the contents of the folder back and quit Mail again.

    2. Repeat with this line:

    /Library/Mail/Bundles

    This time you may be prompted for your administrator login password when you remove the items. Make sure they're removed from the folder and not just copied to the Desktop. If necessary, copy them first and then move the originals to the Trash.

    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select

              Go â–¹ Go to Folder...

    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • by ForTozs,

    ForTozs ForTozs Oct 30, 2014 5:36 AM in response to Linc Davis
    Level 1 (4 points)
    Oct 30, 2014 5:36 AM in response to Linc Davis

    Thanks for the help. Neither one of those folders exist on my machine though. Any other ideas?

  • by Linc Davis,

    Linc Davis Linc Davis Oct 30, 2014 7:26 AM in response to ForTozs
    Level 10 (208,000 points)
    Applications
    Oct 30, 2014 7:26 AM in response to ForTozs

    From the Mail menu bar, select

              Mail â–¹ Preferences... â–¹ Accounts â–¹ Mailbox Behaviors

    and uncheck the box marked

              Store draft messages on the server

  • by ForTozs,

    ForTozs ForTozs Oct 30, 2014 9:49 AM in response to Linc Davis
    Level 1 (4 points)
    Oct 30, 2014 9:49 AM in response to Linc Davis

    Thanks. I tried this, but my issue still remains.

  • by Linc Davis,

    Linc Davis Linc Davis Oct 30, 2014 12:21 PM in response to ForTozs
    Level 10 (208,000 points)
    Applications
    Oct 30, 2014 12:21 PM in response to ForTozs

    Do you have a GoDaddy email account?

  • by ForTozs,

    ForTozs ForTozs Oct 30, 2014 1:33 PM in response to Linc Davis
    Level 1 (4 points)
    Oct 30, 2014 1:33 PM in response to Linc Davis

    No I don't.

  • by Linc Davis,Helpful

    Linc Davis Linc Davis Oct 30, 2014 2:46 PM in response to ForTozs
    Level 10 (208,000 points)
    Applications
    Oct 30, 2014 2:46 PM in response to ForTozs

    According to reports, there seems to be a memory leak in Mail 8.0. I don't know what triggers it. I haven't seen it myself. All I can suggest at this point is that you quit and relaunch Mail when you notice that it's taking more than about 500 MB of memory. Maybe a future OS X update will correct the problem.

  • by ForTozs,

    ForTozs ForTozs Oct 30, 2014 3:37 PM in response to Linc Davis
    Level 1 (4 points)
    Oct 30, 2014 3:37 PM in response to Linc Davis

    That's what I'm hoping for. In the meantime I might just completely disable Mail and use another application. I appreciate all your help.

  • by woodfinish,

    woodfinish woodfinish Oct 31, 2014 6:45 AM in response to ForTozs
    Level 1 (15 points)
    Oct 31, 2014 6:45 AM in response to ForTozs

    This is a bug in either Mail.app or recentsd, and I've reported it to Apple (Radar #18610325). The short version is that Mail.app is constantly asking recentsd for recent contacts (duh) but the sqlite query being used has a hard-coded varying timestamp for recency rather than a parameter:

     

    SELECT recents.ROWID,\n       recents.bundle_identifier,\n       recents.dates,\n       recents.display_name,\n       recents.sending_address,\n       recents.original_source,\n       recents.weight,\n       recents.group_kind,\n       contacts.ROWID,\n       contacts.kind,\n       contacts.display_name,\n       contacts.address\n  FROM recents\n  JOIN contacts ON contacts.recent_id = recents.ROWID\n WHERE     recents.count = 1\n\n AND (kind IN (?)\n AND (cpsearch(contacts.display_name, ?, 5)\n OR icusearch(contacts.address, ?, 2))) AND bundle_identifier IN (?) AND last_date > 1349878830843

     

    Some combination of these processes (recentsd, Mail.app or both) is creating these sqlite queries and never destroying them (some kind of query cache?), and when you look at the continuing memory allocations, they're all the result of sqlite parsing this query over and over.

     

    Somebody from Apple took note of this issue on Twitter the other day, so I think it's under investigation.

  • by woodfinish,Helpful

    woodfinish woodfinish Oct 31, 2014 6:59 AM in response to woodfinish
    Level 1 (15 points)
    Oct 31, 2014 6:59 AM in response to woodfinish

    Note that you can work around at least the recentsd memory consumption without a restart by, from a Terminal not as root:

     

    launchctl stop com.apple.recentsd

    launchctl start com.apple.recentsd

  • by ForTozs,

    ForTozs ForTozs Oct 31, 2014 7:44 AM in response to woodfinish
    Level 1 (4 points)
    Oct 31, 2014 7:44 AM in response to woodfinish

    That is great news that Apple is working on the issue. I will try your fix to recentsd hogging my memory. I saw a post somewhere else that talked about vacuuming your sqlite database. I wonder if this might alleviate some of my problems.

  • by woodfinish,Solvedanswer

    woodfinish woodfinish Oct 31, 2014 7:47 AM in response to ForTozs
    Level 1 (15 points)
    Oct 31, 2014 7:47 AM in response to ForTozs

    Vacuuming sqlite is unlikely to help with this specific issue. That's for cleaning up the on-disk representation of the data, not its use of memory.

  • by ForTozs,

    ForTozs ForTozs Oct 31, 2014 7:51 AM in response to woodfinish
    Level 1 (4 points)
    Oct 31, 2014 7:51 AM in response to woodfinish

    Thanks for the info. I didn't mean to mark this issue as solved, but I must have accidentally clicked that link in the email.

  • by john ted,

    john ted john ted Nov 10, 2014 4:42 PM in response to ForTozs
    Level 1 (0 points)
    Nov 10, 2014 4:42 PM in response to ForTozs

    I have the same issue.  I've noticed that the iMap ports on my GoDaddy iMap accounts does get set to 143.  After I change them back to 993, I notice the same issue and/or the ports get reset again to 143. 

     

    I do notice that once I see Compressed Memory (which I never see), it's all over.  I have to reboot the machine to re-stabilize it and I no longer can leave mail open.

     

    What's really frustrating is that while composing email, I see this several times during a long composition.

     

    PLEASE APPLE - FIX THIS!!!

Page 1 Next