Hacker News new | past | comments | ask | show | jobs | submit login

> As far as I'm aware, witing to a file doesn't require any memory allocation on any of the major OSs, so you can most definitely save the user's work when running out of memory.

Course it does. You can’t run any code in a typical app environment without allocating heap objects as you go, and even if you didn’t, anything that accesses a swapped out page is “allocating physical memory”.

And once it gets into the kernel, file systems have to allocate their own objects to track new writes. Though if the kernel is failing to allocate memory you have worse problems.




https://man7.org/linux/man-pages/man2/write.2.html

write doesn't require you to allocate any memory


You have to build the serialized data you’re writing first.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: