I suddenly started having an issue where both manual and auto saves result in a crash most of the time, the save file is created but its corrupted due to the game never being able to finish the save. A working save is 117MB, judging by how sudden this issue is I'd guess I have reached a point where the game is having issues writing the stream into the file. It is gamebreaking at the moment as I can never know whether the next save will go through or simply crash.
I was able to download your save game file and view the error message with the latest links you provided. The error message indicates that your game has so much data that when the game was saving your game, it was unable to allocate memory it required for the file compression function to compress your game data. (The game uses a file compression function to compress the raw game data before it saves to a savegame file.) In your case, the memory the memory compression function required is a block of free memory of approximately 160MB, as indicated by the error message.
Closing other Windows applications while running the game will help. Giving your Windows a reset and run the game after the reset will also help. And when you start your next game from scratch, I would recommend that you reduce the number of cities from 10 to 7 or lower, so that it will use less memory.
It could be due to Memory fragmentation. The error message tells that the game needs to allocate a single, continuous block of memory of 160MB. There is a possibility that the memory of your computer has become fragmented and is unable to supply a single memory block of 160MB.
For your information:
Memory fragmentation is when most of your memory is allocated in a large number of non-contiguous blocks, or chunks - leaving a good percentage of your total memory unallocated, but unusable for most typical scenarios. This results in out of memory exceptions, or allocation errors (i.e. malloc returns null).
The suggestions I wrote in my previous posts should help mitigate it:
Closing other Windows applications while running the game will help. Giving your Windows a reset and run the game after the reset will also help. And when you start your next game from scratch, I would recommend that you reduce the number of cities from 10 to 7 or lower, so that it will use less memory.
I gave the same game a test on a cleaner environment, and while initially it worked great, the error began to creep back in after a few hours which is in line with the memory fragmentation idea, but still somewhat questionable due to the amount of total memory I have an that no other application has ever had such an issue before.
David, would it be possible to catch this error and add a "Failed to save game" or similar popup, so we can try to save again instead of crashing and losing progress?