troelsbjerre / Bottleneck

Factorio mod that tell you which assemblers are starved of ingredients
Other
26 stars 21 forks source link

0.5.0 to 0.5.1 update uses crazy amounts of RAM #17

Closed troelsbjerre closed 7 years ago

troelsbjerre commented 7 years ago

From https://mods.factorio.com/mods/trold/Bottleneck/discussion/6579

Something in the 0.5.0 to 0.5.1 update process causes huge amounts of RAM to be used when loading an existing save.

My existing save went from using around 4GB RAM when loaded, to using over 10GB when first loaded with the 0.5.1 version.

This was a challenge to get working - PC swapping like mad for ages, and factorio crashed due to low memory on the first attempt.

Once I managed to load the game and re-save it, it seems OK, so just something about the upgrade process I think.

It may be another mod, not bottleneck - as something similar occurred just after this when I installed another mod and loaded the save. Bottleneck did show it's 'building from scratch' message this time too, but it's possible another mod is also hooking that event, and causing the issue, but remaining silent about it's activity.

Other mods installed:

Here's the save game and set of mods that caused me the RAM problems.

http://www.jonatkins.com/factorio/bugs/mod-upgrade-ram-0.14/

troelsbjerre commented 7 years ago

I didn't have time to look at it properly, but the behavior described in the bug definitely shows up. Removing the Bottleneck mod, or keeping it at 0.5.0 avoids the problem.

Nexela commented 7 years ago

Ouch, Any time the rebuild is called on a "hugely decorated map" this will happen. It is related to the speed change on rebuilding icons and possibly Factorio not garbage collecting correctly afterwards. I didn't take this into consideration (the big test worlds I have been using have all decorations removed)

His map has almost 6 million decorative entities......... After upgrading - 9GB-11GB for the world After taking a save after upgrading Bottleneck and reloading the map is only using 3GB After Destroying all decorative and saving/ loading Ram usage went to Under 2GB, and save file size went from 80MB to 54MB.

For now I recommend uninstalling bottleneck, install mod https://mods.factorio.com/mods/orzelek/undecorator Load the world (it might shoot up to about 10GB again). After it loads Save and reinstall bottleneck.

I'll shoot over a pull request that will fix this. The change to direction based doesn't have this problem but unfortunately that isn't ready to shoot over yet.

troelsbjerre commented 7 years ago

You don't even need to uninstall Bottleneck before installing unDecorator. Bottleneck is robust enough to handle having its indicator lights destroyed by another mod.

Nexela commented 7 years ago

Sorry, should have clarified it some. uninstalling bottleneck before running undecorater was suggested due to the amount of decoratives and only applies to .51 version. If bottleneck.51 runs before undecorater there is a chance the ram usage will double again and be un-loadedable. This won't be a problem with .52 :)

troelsbjerre commented 7 years ago

Oh, right. If Bottleneck's rebuild is triggered before unDecorator's initial scan, then the memory spike is back, and my laptop sits in the corner crying.