Memory allocation crash on save, corrupts save file

Technical support requests for Capitalism Lab
Post Reply
_white_
Level 2 user
Posts: 30
Joined: Mon May 04, 2020 1:28 pm
Has thanked: 1 time

Memory allocation crash on save, corrupts save file

Post by _white_ »

Hello,

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.

Image

https://easyupload.io/lkxi2a
User avatar
David
Community and Marketing Manager at Enlight
Posts: 10438
Joined: Sat Jul 03, 2010 1:42 pm
Has thanked: 78 times
Been thanked: 228 times

Re: Memory allocation crash on save, corrupts save file

Post by David »

Could you please post a large version of the screenshot? It is too small and I cannot see the error message clearly.

And when I attempted to download your save game file, I got an "access denied" error.
_white_
Level 2 user
Posts: 30
Joined: Mon May 04, 2020 1:28 pm
Has thanked: 1 time

Re: Memory allocation crash on save, corrupts save file

Post by _white_ »

The screenshot looks normal to me, reuploaded it here: https://imgur.com/a/ABR7bTr

As for the save file it is also accessible for me, but i reupped it here (had to cut the file into two due to the size):

https://file.io/EOlXFf1oLbBC
https://file.io/BqBNxWUpX1y7

Let me know please if these are still broken, successfully uploading large files is a pain
User avatar
David
Community and Marketing Manager at Enlight
Posts: 10438
Joined: Sat Jul 03, 2010 1:42 pm
Has thanked: 78 times
Been thanked: 228 times

Re: Memory allocation crash on save, corrupts save file

Post by David »

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.
_white_
Level 2 user
Posts: 30
Joined: Mon May 04, 2020 1:28 pm
Has thanked: 1 time

Re: Memory allocation crash on save, corrupts save file

Post by _white_ »

I have 32GB of RAM so there was definitely enough system memory available, is this a limitation with the memory the process can allocate to itself?
User avatar
David
Community and Marketing Manager at Enlight
Posts: 10438
Joined: Sat Jul 03, 2010 1:42 pm
Has thanked: 78 times
Been thanked: 228 times

Re: Memory allocation crash on save, corrupts save file

Post by David »

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.
paulwoman
Translation Contributor
Translation Contributor
Posts: 783
Joined: Tue May 24, 2016 4:22 pm
Has thanked: 6 times
Been thanked: 7 times

Re: Memory allocation crash on save, corrupts save file

Post by paulwoman »

Just for your information:

There was a time when I had bugs galore in the game.

A good part of it was solved by putting back an old image created by acronis true image, which is similar to doing a "clean" windows installation.
_white_
Level 2 user
Posts: 30
Joined: Mon May 04, 2020 1:28 pm
Has thanked: 1 time

Re: Memory allocation crash on save, corrupts save file

Post by _white_ »

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?
User avatar
David
Community and Marketing Manager at Enlight
Posts: 10438
Joined: Sat Jul 03, 2010 1:42 pm
Has thanked: 78 times
Been thanked: 228 times

Re: Memory allocation crash on save, corrupts save file

Post by David »

I've sent you a test version of the game via PM (private messaging).
Post Reply