Hi,
The number of messages stored locally in the app is the "Messages to keep" setting, the default is 250. This is under each account's Options and Folders, and there can be a per-folder override (the settings icon to the right of the folder name, on the same screen, below).
The app should maintain this limit automatically, but you might wan to use Menu / Compact message store in the main window (account list) to see if this helps.