After looking at a profile, and it suddenly occurred to me what the problem may be for the excessive memory consumption, and yes, it would be my fault.
Do you know the overlay areas? In the graph screen when playing the game, you can select to draw overlay areas, which can show you where your defense is best, or the highest concentrations of starving or damaged units, usefull to know where to place hospitals or inns.
Well, I made the mistake of storing one for every statistic frame, and there are 128 of them. As soon as the game initiates, it fills 3 * 128 vectors with width*height integers, and thats huge memory. Provided sizeof(int) is 3 (24 bits), the total usage (per team) is 18 mb on a 128x128 map, and 288 mb on a 512x512 map, which explains the problem. I feel rather near sited not to have seen this when I made the feature last year.
I'm making the correction in the master, to only compute for the current frame, only for the local team, only for one vector at a time, and using Uint16 to limit the size of the integer, since this is all thats required. No memory is waisted.
I have commit the fix to the master branch (and merged into the gamegui_rewrite_2007 branch). The game runs noticably faster now, and with less memory.