JGRennison / OpenTTD-patches

OpenTTD - http://www.openttd.org/ - with additional patches
Other
581 stars 133 forks source link

[Crash]: Out of memory issues when saving game #408

Closed Hyckor closed 2 years ago

Hyckor commented 2 years ago

Version of OpenTTD

0.48.1, Win7 and Win11

Steps to reproduce

The game usually crashed during saving. Sometimes, it gives message: Game save failed. Internal error: cannot initialize compressor (screenshot 2). After this message, the game sometimes continues, but it is impossible to save it - the same message repeated. The screenshots 1 and 3 show messages after several attempts to save it - Out of memory. Cannot allocate XXXXXXX bytes. The game runs and crashes on older laptop - Win 7 and also on newly-bought desktop - Win11. The version is 0.48.1, but it crashes also in version 0.45 and 0.48.

Crash screenshot 03 Crash screenshot 01 Crash screenshot 02

Upload crash files

OpenTTD.zip

James103 commented 2 years ago

The game runs and crashes on older laptop - Win 7

  1. How much RAM do you have on your computer?
  2. What map size are you trying to save?
  3. Are you able to reproduce this with as few other running programs as possible?
Hyckor commented 2 years ago

RAM on that older laptop is 3GB, but it crashes also on newly-bought desktop having lot of RAM. Map size is cca. 8192x4096 px, but I played this map 10 years on the same laptop and it worked fine until now.

Hyckor commented 2 years ago

Yes, I reduced all necessary programs, but this is not the issue. As I said before, I tried to play and save it on very fast desktop bought in 2021. I suspect Newgamegrfs adding in-game.

James103 commented 2 years ago

How much RAM does your newer desktop have? If that's less than 8 GB, then you may need to upgrade the RAM to at least that amount, or more if possible. Try checking both the Processes and Performance tabs in Task Manager while playing and watch for any spikes in RAM usage.

Hyckor commented 2 years ago

How much RAM does your newer desktop have? If that's less than 8 GB, then you may need to upgrade the RAM to at least that amount, or more if possible. Try checking both the Processes and Performance tabs in Task Manager while playing and watch for any spikes in RAM usage.

This is not the issue. I played the same map and same world a month ago with no problems. I played the same own-built world map 10-12 years in a row - systematically building the traffic infrastructure. Of course, I reduced all visual effects, all unnecessary programs in a background to minimum to save memory. I increased the virtual memory, but this is not a problem I guess. My new desktop is so fast for that game, so I made an experiment and played a while the several most recent savegames, but it crashed in a same manner. I do not know how much RAM it has and I will able to check it Monday (not at home during weekend), but there are memory-consuming FPS working fine.

JGRennison commented 2 years ago

If you've got a valid save of this (i.e. what you're loading from before you try to save), that may be useful.

You may want to try allocating more system swap.

Hyckor commented 2 years ago

If you've got a valid save of this (i.e. what you're loading from before you try to save), that may be useful.

You may want to try allocating more system swap.

ok, here it is, but some grf files are my own-made (not in repository elsewhere). Note: rename file Auriga.Investments.2022-01-26zo1.zip to Auriga.Investments.2022-01-26.zo1 (it was not possible to upload directly). You will get two disk archives zip and zo1 = 27 MB of sole sav file Auriga.Investments.2022-01-26.zip Auriga.Investments.2022-01-26zo1.zip .

James103 commented 2 years ago

Auriga.Investments.2022-01-26zo1.zip

7-Zip can open the archive, but it fails to decompress the file. Are you able to upload the saved game to your Dropbox, Google Drive, or another file-hosting service?

Hyckor commented 2 years ago

Auriga.Investments.2022-01-26zo1.zip

7-Zip can open the archive, but it fails to decompress the file. Are you able to upload the saved game to your Dropbox, Google Drive, or another file-hosting service?

sure, here it is https://www.uschovna.cz/zasilka/BA572JSX9D86Z38D-945/

JGRennison commented 2 years ago

The savegame does not look too unreasonable. The 4.5 million objects does seem a bit overkill though.

The crash log indicates that you are using a 32 bit build, use the 64 bit build instead.

Try setting gui.threaded_saves to false in your openttd.cfg config file. This should reduce the quantity of memory required for saves.

Hyckor commented 2 years ago

The savegame does not look too unreasonable. The 4.5 million objects does seem a bit overkill though.

The crash log indicates that you are using a 32 bit build, use the 64 bit build instead.

Try setting gui.threaded_saves to false in your openttd.cfg config file. This should reduce the quantity of memory required for saves.

OK, I'm gonna check it, thanx a lot. Hyck.

Hyckor commented 2 years ago

How much RAM does your newer desktop have? If that's less than 8 GB, then you may need to upgrade the RAM to at least that amount, or more if possible. Try checking both the Processes and Performance tabs in Task Manager while playing and watch for any spikes in RAM usage.

That desktop configuration: Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz 3.10 GHz, RAM = 16 GB, 64-bit operating system, x64-based processor and still crashed.

Hyckor commented 2 years ago

The savegame does not look too unreasonable. The 4.5 million objects does seem a bit overkill though.

The crash log indicates that you are using a 32 bit build, use the 64 bit build instead.

Try setting gui.threaded_saves to false in your openttd.cfg config file. This should reduce the quantity of memory required for saves.

OK, I set gui/ threaded_saves to false and it crashed again on desktop ( Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz 3.10 GHz, RAM = 16 GB, 64-bit operating system, x64-based processor), so I'm gonna try 64-bit build, however that laptop is 32 bit, probably dead end on it. Do you think, it helps to reduce number of objects? There are quantity of false desert and snow tiles as objects (polar regions and most of deserts are completed now) which increased the size from usual 15 MB to 27-28 MB/ sav file. I must say, I do not like to play OTTD on very latest computers - fast and unnatural animation of the gameplay. I rather play on older machines :-(

James103 commented 2 years ago

I must say, I do not like to play OTTD on very latest computers - fast and unnatural animation of the gameplay.

You can reduce the value of "Interface > Fast-forward speed limit" to control how fast the game runs. The default value is a speed factor of 25x over the normal speed limit, which means if you always play on fast-forward, the game runs at up to 25 times its normal speed (based on single-threaded performance on CPU). Setting the value to 200% (2x) makes fast forward double the game speed at most, and setting it to 50% makes the fast-forward button slow the game down by a factor of 2.

The default value, as well as how to get to the setting, should look like this: image

Hyckor commented 2 years ago

I must say, I do not like to play OTTD on very latest computers - fast and unnatural animation of the gameplay.

You can reduce the value of "Interface > Fast-forward speed limit" to control how fast the game runs. The default value is a speed factor of 25x over the normal speed limit, which means if you always play on fast-forward, the game runs at up to 25 times its normal speed (based on single-threaded performance on CPU). Setting the value to 200% (2x) makes fast forward double the game speed at most, and setting it to 50% makes the fast-forward button slow the game down by a factor of 2.

The default value, as well as how to get to the setting, should look like this: image

OK, at first moment I was really happy, but I realized that this value have no impact on speed. The game goes really fast having value 1% as well as 25000%. There is a note: ... when fast forward is enabled. Pls, do you know, how to enable/ disable this function?

James103 commented 2 years ago

Click this button in the toolbar to toggle fast-forward: image. If you see it pressed, then fast-forward is active and affecting the simulation rate based on the value of the setting "Fast forward speed limit".

Hyckor commented 2 years ago

Click this button in the toolbar to toggle fast-forward: image. If you see it pressed, then fast-forward is active and affecting the simulation rate based on the value of the setting "Fast forward speed limit".

Yes, meanwhile I found this function. It works. Thanx a lot.

Hyckor commented 2 years ago

Hello there, Thanx a lot. I reinstalled WIN 7 to 64-bit version and OTTD works on that old laptop as before it does.