[2.0.42][linux] Severe memory leak after standby resume
Posted: Sun Mar 30, 2025 8:48 am
Since a few days ago I am experiencing severe memory leaks when I go back to the game after a standby+resume. The game was not shut down during the standby, so it involves tabbing back into the paused game and going back to playing.
The memory leak is rapid and goes to about 20GB usage when my ram runs out and my system starts swapping. This is when I noticed it, because the kswapd0 process takes up all my CPU power and factorio UPS/FPS go down and down and down. If I just let it run for more than a minute like this my entire system will become inoperable (presumably at some point the oom killer would kick in, but since swapping at that point makes the system effectively unresponsive, who knows how long that would take).
This started either after one of the last 2 patches or after a system update, or after I changed my xfwm4 vblank method to "xpresent" to fix some other issues. I have not seen similar behavior from any other program, so for now I'm inclined to believe it might be a factorio thing.
I have also noticed that the memory usage of the game goes up by about 2GB if left paused and tabbed out for a while. Might be completely unrelated and fine though, since it goes back down those 2GB immediately once the game gets focus again.
What would my next steps be in information gathering for this?
Log file attached, but doesn't have anything interesting as far as I can tell.
Memory timeline:
Game has been running for a while normally
Standby & Resume then going back into the game
The memory leak is rapid and goes to about 20GB usage when my ram runs out and my system starts swapping. This is when I noticed it, because the kswapd0 process takes up all my CPU power and factorio UPS/FPS go down and down and down. If I just let it run for more than a minute like this my entire system will become inoperable (presumably at some point the oom killer would kick in, but since swapping at that point makes the system effectively unresponsive, who knows how long that would take).
This started either after one of the last 2 patches or after a system update, or after I changed my xfwm4 vblank method to "xpresent" to fix some other issues. I have not seen similar behavior from any other program, so for now I'm inclined to believe it might be a factorio thing.
I have also noticed that the memory usage of the game goes up by about 2GB if left paused and tabbed out for a while. Might be completely unrelated and fine though, since it goes back down those 2GB immediately once the game gets focus again.
What would my next steps be in information gathering for this?
Log file attached, but doesn't have anything interesting as far as I can tell.
Memory timeline:
Game has been running for a while normally
Standby & Resume then going back into the game