And I had the exact opposite experience as you just last week on multiple machines with swap enabled: compiling and going over the available memory made them entirely inoperable and required hard resets. Had to use another computer to be able to browse internet at the same time, until earlyoom can be installed there.
Sounds like the cause is orthogonal to the presence of swap. What kind of persistent storage do you have on those computers? For me it's been an M.2 in both cases.