Thunderbird very high load with gmail IMAP

I have two gmail accounts that I use for all my email. When I first set them up as POP accounts in Thunderbird, it killed me. There are hundreds of thousands of emails to download and it took a couple of weeks to download them, followed by nearly a month of archiving.

Now I have a new job and I’ve set them up as IMAP accounts. And most of the time it runs fine, but sometimes I do something that triggers Thunderbird to want to download tens of thousands of emails and so it maxes out my CPU and eventually locks up the machine. Sometimes it doesn’t even show that it’s doing anything, I just notice things getting very laggy.

Doing a sudo killall -9 thunderbird immediately solves the lag, although it can take me literally 5-10 minutes to get a terminal up and type in and run the command.

Is there any way to permanently limit the resources that Tbird can use? I mean, I wouldn’t mind it downloading all that crap if I could prevent it from locking the system up. I’d let it run all night doing whatever it wanted for however many days until it was happy…

Or is there another IMAP client that would allow me to talk to gmail and not balk at the large numbers of emails?

(I wish it was easy to clean all that crap out from gmail, but it’s really not)