Re: trying to make a mod, accidentally crashed my whole computer
Posted: Thu May 26, 2016 11:32 am
And what do you want Factorio to do about this? What could it possibly do? It can't know how much memory the system has to spare, knowing this is the job of the kernel. So Factorio requests some memory from the system. If this works, Factorio uses this memory (why shouldn't it?); if it doesn't, a "cannot execute command: out of memory" error message is displayed. This is working properly.
Now if the kernel hands out more memory than it should there is a problem.
On Linux this can happen if overcommitting is enabled, which tends to be the default. This means the kernel might be optimistic and grant memory allocations even if there isn't enough memory available, hoping the requested memory won't actually be used (some processes like doing this apparently). Now if the memory does get used, a process needs to die to free up some memory. This will be whatever uses a lot of memory, likely Factorio in this example but it might also hit Firefox first if you have a ton of tabs open. This is a kernel issue, if you don't want to see random processes dying, you can disable overcommitting with sysctl vm.overcommit_memory=2. Then the kernel will just deny allocations when the system is out of memory and you will see the proper error message in Factorio.
Not sure how this works on Windows, but if the kernel shits itself before it starts denying memory allocations, that's a problem with the kernel.
So... if a memory allocation fails, Factorio displays the proper error message and gets on with life. If memory gets allocated successfully and the system still gets into trouble, there isn't anything Factorio can do about it.
Now if the kernel hands out more memory than it should there is a problem.
On Linux this can happen if overcommitting is enabled, which tends to be the default. This means the kernel might be optimistic and grant memory allocations even if there isn't enough memory available, hoping the requested memory won't actually be used (some processes like doing this apparently). Now if the memory does get used, a process needs to die to free up some memory. This will be whatever uses a lot of memory, likely Factorio in this example but it might also hit Firefox first if you have a ton of tabs open. This is a kernel issue, if you don't want to see random processes dying, you can disable overcommitting with sysctl vm.overcommit_memory=2. Then the kernel will just deny allocations when the system is out of memory and you will see the proper error message in Factorio.
Not sure how this works on Windows, but if the kernel shits itself before it starts denying memory allocations, that's a problem with the kernel.
So... if a memory allocation fails, Factorio displays the proper error message and gets on with life. If memory gets allocated successfully and the system still gets into trouble, there isn't anything Factorio can do about it.