Memory Leak in Mail

A search for “memory leak” on the forums only showed a recent thread for EagleFiler.

However, I’m also experiencing a severe memory leak with SpamSieve when using Apple Mail. After about a day, the real memory is close to 1 GB and the VM is close to 2 GB. If I disable the rule that invokes SpamSieve, then I no longer get the leak.

I have 2 GB of physical RAM in my dual 2.3 GHz, G5. As a result, when the leak is large, everything slows down and hammers the disk with paging when switching between programs. I quit Mail and SpamSieve, relaunch, and everything is fine for awhile.

Is it Mail or SpamSieve that is using 1 GB of real memory? How much private memory is it using? Do you have any SpamSieve windows open during the filtering?

It was Mail that was using all the memory. I don’t recall what SS’s allocation was.

I was not displaying the private memory when the leak occurred so I don’t know. I’ve turned on that column now and will wait for the memory to build up again.

SS was hidden so I don’t remember if I had the Stats window open.

I’ve done some more investigation, which may just confuse the issue.

  • Real and VM memory was leaking around 0.07 MB every 5 sec update of Activity Monitor. That’s roughly 50 MB/hour or 1.2 GB/day.
  • I logged in as a new user, set up Mail without SS and did not notice any leak.
  • I returned to my regular user account, launched Mail without SS and did not notice any leak.
  • I turned on SS, retrieved some mail, sent mail to myself and retrieved it, and no leak was observed.
  • I could find no relevant discussion on Apple’s support forum regarding memory leaks in Mail.

Since I’ve observed memory leaking for many days now and having to kill Mail every day or so, something must trigger the leak to occur. Once it gets going, it continues until I notice the sluggishness of the system and restart Mail.

I’ll try to keep a closer eye on the leak and see if I can determine what causes it to start.

OK, please let me know what you find. I’m not aware of any leaks caused by SpamSieve’s Mail plug-in, and if there were one I would not expect it to leak at a constant rate. The plug-in is only doing something when you train SpamSieve or when new messages arrive, so if the plug-in is the cause of the leak then you’d probably see the increased memory use linked to those operations.

In the post that you linked to above, we observed that using Safari can cause other applications that use Web Kit to leak memory, even if the application is completely idle. Were you using Safari?

If you type “leaks Mail” into Terminal you may be able to get some information about what type of objects are being leaked.

I give up. I don’t think it is related to SS anymore. It was probably just the change of turning off SS and restarting Mail, which stopped the leak, that made it look as if SS was the problem.

It wasn’t leaking for a long while this afternoon, even with SS running. When I started to shut down some windows and apps, the leak started. I quit out of all other applications and killed as many processes as I could find and Mail kept leaking.

I restarted the Mac and Mail immediately started leaking. I’ll have to play around with startup programs to see if there’s anything related. So I really don’t know what causes the leak to start, but nothing seems to stop it.

I guess I’ll have to post on the Apple forum to see if anyone knows what’s going on.

The “leaks Mail” command does not work for me. Is this a developer tool that needs to be installed?

Anyway, thanks for your help and sorry for the false alarm.

Found it!

It was an IMAP account that appeared to work fine, but when I checked the Console logs, Mail was complaining that it could not select the Inbox. This was happening every 5 seconds.

Why it went away earlier this afternoon, and why it came back I’ll probably never understand.

I don’t know why the account works fine but Mail still complains.

Anyway, this is one for Apple.

Yes, I forgot to mention that it’s part of the Xcode tools. Glad you found the source of the problem.