01-10-2023, 09:27 PM
(01-10-2023, 02:45 PM)Spriggsy Wrote: For the ones who truly need this function (whether because they're dealing with ridiculous text files of inordinate sizes or wanting to save a video), couldn't they also just do a check for available drive space on the destination drive before writing the file in the meantime? Seems like there would be no need to "preallocate" anything if one would just check that they're not trying to fit fifty pounds of flour in a five pound bag. Also, modern Windows automatically schedules defrag tasks for weekly runs.
You can, but it's not nearly as effective since it doesn't actually guarantee the space will still be there when you get to the end. Say you run two of these processes that make a 4GB file and there's 5GB of disk space left. Both programs will think they have enough, but collectively you will run out before one or both of them can finish creating their files. By preallocating the files one of those processes will fail on the preallocation step instead.