Adding my experience to the original issue...
I have a new MBP (late 2013, with OS X Mavericks). It's an out-of-the-box machine; I did not use Migration Assistant to port any data or settings. Instead, I am using System Preferences/Internet Accounts to configure each of my many email accounts (all IMAP). System Preferences seems to have a few bugs in this regard, so I worked methodically in order to minimize flakiness: open System Preferences, add a single account, close System Preferences, open Mail, tweak Mail preferences for the account, close Mail. I monitored relevant plists during the process, and nothing was amiss.
As I added more accounts, the time for Mail to open (and sometimes to close) became excessive. Eventually, I hit the "out of application memory" wall. I removed a few accounts, and I was again able to open Mail successfully (albeit slowly). I de-activated more accounts, without removing them. Mail opened faster with each de-activated account. After reducing the number of active accounts to only a few, Mail opened (and closed) relatively quickly again.
I opened Activity Monitor to observe Mail's behavior. With only a few active accounts, when I opened Mail, mds_stores (part of the metadata server) was CPU intensive, followed by Mail. Mail would calm down roughly after the main window opened. Memory pressure was flat green throughout.
However, with several active accounts, when I opened Mail, mds_stores would light up, followed by Mail, followed by kernel_task, which then went crazy. Mail's memory usage was extremely high for a moment before dropping (though still high), at which point kernel_task would consume everything else. It was during this time that the memory pressure was in the red, pushing the ceiling. When the main window finally opened, Mail and kernel_task settled down, and the memory pressure returned to flat green. Funnily enough, I could then activate the remaining accounts from within mail, with no adverse effects.
In my case, there seems to be an issue with the number of Internet Accounts I have configured for Mail. If the number is above a threshold (about 7), opening Mail triggers some process that consumes excessive resources. Above a higher threshold (about 12), the resource consumption is unmanageable, and I get the "out of application memory" error. I should also note that choosing to activate accounts with few messages seems to make no difference to the thresholds.