Gmail gives you the opportunity to limit the number of messages that can be stored your IMAP folders. The procedure is as follows:
- Log-in to your Gmail account.
- Click on "Settings".
- Go to "Forwarding and POP/IMAP" and scroll to "Folder Size Limits".
- Select "Limit IMAP folders to contain no more than this many messages" and use the drop menu to choose the number of messages: