A coworker of mine noticed after cleaning up his IMAP folders, that he managed to fill INBOX.Trash with 313.924 mails, and Thunderbird failed utterly at managing that folder.
He then tried to open it with Claws Mail, which succeeded at the second attempt (a wifi disconnect ruining it at 70% the first time – and the 200 MBs of downloaded data got leaked in libetpan, bad).
The second time, the folder opened:
As you can see, the folder is big. We discovered an overflow in the size handling in the process: the mailbox was bigger than 1GB… Claws consumed 670MB of memory with that folder open, but it handled it.
When trying to empty it, we noticed that setting \Deleted flags was really slow, and the server process was using 99.9% CPU on the server. We ended up destroying the mbox on the server.