I don't know about Hotmail, but with GMail you can go to your settings at gmail.com and in the IMAP section limit folders to a certain amount of messages.
Also, go to the labels tab and turn off sync of the IMAP All Mail folder as this is a duplicate of all the other folder in GMail and results in double the download for each message.