[16.16] Slow memory leak on consecutive reloading of game

Bugs that are actually features.
Post Reply
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2485
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

[16.16] Slow memory leak on consecutive reloading of game

Post by FuryoftheStars »

Hi, I've noticed a small memory leak when consecutively reloading the game from making changes that require game restart (enable/disable mod, change mod or game setting that require restart, etc). I do have a large mod list so expect that the game will use a lot. After the game restarting enough times from my doing this, Windows will pop a message about low memory and how it will close programs as needed. Eventually, after several more times of having the game reload, Factorio will close out / CTD during game load. Attached log file from when it did this. I expect this would be a low priority issue, but wanted to report it.

To give further in-depth details behind how I ran into this, I noticed a compatibility issue with some of my loaded mods and was trying to track down the exact mods causing the issues. So, I would make an adjustment in what mods were enabled or I would go into the mod options and adjust an On Startup setting, let the game reload, then would generate a new map and test for the bug. Quit map, rinse and repeat.

It does not appear that doing a full quit/exit from the game fixes this, either, for some reason. In retesting for this and monitoring memory usage in Task Manager, I caused Factorio to restart several times (noting each time that total memory usage did rise) until I started getting the warning from Windows. RAM usage started off around 11.6 GB peak during game load (ie, after restarting computer) and was over 14-15 GB peak (after the several consecutive restarts of Factorio) when Windows started prompting the warnings. I then completely closed out Factorio and relaunched it from Steam, to still see the memory usage at the 14+ GB peak levels. Total physical RAM is 16 GB.
Attachments
factorio-current.log
(23.29 KiB) Downloaded 27 times
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [16.16] Slow memory leak on consecutive reloading of game

Post by Rseding91 »

Thanks for the report however that's not how memory leaks work.

A memory leak is memory that a specific process is still holding on to that it should have released back to the operating system. No matter how that happens when the process is terminated (via exiting normally or killing it in the task manager) that memory is always released back to the operating system.

What you describe sounds like windows caching files you're re-using over and over as the game loads. Which is perfectly normal.

Unless you can show a sustained memory increase in the Factorio process while it's open when it shouldn't be allocating memory I don't see anything for us to look into.
If you want to get ahold of me I'm almost always on Discord.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2485
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [16.16] Slow memory leak on consecutive reloading of game

Post by FuryoftheStars »

Well, after posting that and keeping an eye on it again for a while, I believe I was wrong when I said it wasn't releasing resources even after properly quitting the game.

I do know that this has happened to me before, just now decided to post about it. It always seems that doing the consecutive restarts of the game long enough and it starts taking longer and longer to load until it finally does a CTD. After the CTD it operates as normal again. As I'm sure I'm going to be continuing with the restarts (balance testing of a mod I'm creating), I'll try to keep a better eye on the behavior.

In reference to the Windows caching not releasing, I can't say I've seen this with other programs, but not sure if that's a known issue with Windows.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [16.16] Slow memory leak on consecutive reloading of game

Post by Rseding91 »

I looked at the log file and it's not showing any crash in it. It just ends?
If you want to get ahold of me I'm almost always on Discord.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2485
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [16.16] Slow memory leak on consecutive reloading of game

Post by FuryoftheStars »

Correct. You can see the Out of memory message at line 334 and 335 mentions falling back onto normal sprite loading. But yeah, the game just simply disappeared off from my screen and was no longer running. The log file as you see it is how I found it.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Post Reply

Return to “Not a bug”