Page 1 of 1

[2.0.15] Crash "Error ParallelScenarioSaver.cpp:151: Saving scenario failed: bad allocation"

Posted: Wed Nov 20, 2024 11:52 pm
by Keith69
I don't think this crash was fixed in any new releases. It happened when I was tabbed off working on something else while factorio ran in the background. It crashed my entire video driver not just Factorio. It prompted me to open the attached file and post it on the forum.

Re: [2.0.15] Crash "Error ParallelScenarioSaver.cpp:151: Saving scenario failed: bad allocation"

Posted: Fri Nov 22, 2024 9:59 pm
by Loewchen
Looks like you genuinely ran out of memory at the moment of saving.

Re: [2.0.15] Crash "Error ParallelScenarioSaver.cpp:151: Saving scenario failed: bad allocation"

Posted: Sat Nov 23, 2024 3:11 am
by Keith69
I really don’t think I ran out of memory, I have 32 GB with 100 Gb swap. I have never ran out of memory doing anything. Even if I did, it should have been handled gracefully and not break stuff.

Re: [2.0.15] Crash "Error ParallelScenarioSaver.cpp:151: Saving scenario failed: bad allocation"

Posted: Mon Nov 25, 2024 10:44 pm
by Rseding91
Factorio asks the operating system for memory and if it says "no" all we can do is abort what ever action we were going to do. In this case it did, but then it needed memory for something else which also failed and eventually something gives and the process crashes. I do not know of any way for a user-space process to crash your graphics drivers. Likely they also had an allocation fail which caused them to crash.

Re: [2.0.15] Crash "Error ParallelScenarioSaver.cpp:151: Saving scenario failed: bad allocation"

Posted: Tue Nov 26, 2024 10:28 pm
by Keith69
I really dont think that is what happened because it would require me to have been using 132 gb of memory, which I was not.

Re: [2.0.15] Crash "Error ParallelScenarioSaver.cpp:151: Saving scenario failed: bad allocation"

Posted: Wed Nov 27, 2024 2:10 am
by khoek
Keith, not sure how much C++ programming experience you have so sorry if you already know this, but the exact text "bad allocation" was printed because part of the system standard library (not Factorio) threw an exception called `std::bad_alloc` (you can google this). The words "bad allocation" are returned by calling `e.what()` on the exception.

According to the C++ standard, `std::bad_alloc` is thrown when the standard library fails to allocate memory. It does this by asking the operating system for it. For some reason, on your computer the operating system refused; as you say, this could technically be for a reason other than running out of memory. But at any rate, at that point Factorio is out of luck.

Also, as one of the devs say, even though I'm sure you and I have both seen at various times games crash our graphics drivers, that's always always a bug in the graphics driver (and often they are actually associated with security vulnerabilities). Games can issue updates to work around those bugs, "fixing them", but it's always the driver author's fault.